[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SV: 20060119: SV: 20060110: Gempak - gdplot2 and mapserver projections
- Subject: SV: 20060119: SV: 20060110: Gempak - gdplot2 and mapserver projections
- Date: Thu, 26 Jan 2006 11:22:03 +0100
Hi,
I just want to tell you that Mapserver/gdplot2 works perfectly now.
The problem was that when Mapserver called my program, which would run gdplot,
I had to do a transformation from 'bounding box' in Mercator to lat/long. That
conversion initiallay produced 12 decimals, which was used in the 'GAREA'
parameter. Then something went wrong, gdplot2 could not interpret that
correctly. When I went down to 4 decimals it suddenly worked!
So, all is OK and if you happen to get more questions about Mapserver and grid
plotting you can refer to me and I will give the details in Mapserver
configuration.
Thanks again.
Regards Bengt
-----Ursprungligt meddelande-----
Från: Unidata Support [mailto:address@hidden]
Skickat: den 19 januari 2006 19:18
Till: Nilsson Bengt
Kopia: Unidata Support
Ämne: 20060119: SV: 20060110: Gempak - gdplot2 and mapserver projections
Nilsson,
The CED projection is the lat/lon projection mentioned previously
in my example where latitude and longitude were linearly mapped
to the display pizels.
To see the formulation of the projection coordinate transformation that
GEMPAK is using for Mercator, see:
$GEMPAK/source/gplt/transform/gmer*
Steve Chiswell
Unidata User Support
>From: "Nilsson Bengt" <address@hidden>
>Organization: UCAR/Unidata
>Keywords: 200601191318.k0JDIT7s004636
>Hi again,
>
>I'm so sorry to bother you again but I think that is just a question about a f
> ew (important) details to get gdplot2-images integrated into normal mapserver
> handling.
>
>1. I know now why I can't merge a raster from gdplot2 with a 'normal' mapserve
> r layer: It's because of coordinate transformation mismatch: If I for example
> want a mercator-projected image as a result from mapserver then I have to gi
> ve the map extent in mercator-coordinates. When mapserver calls the gdplot2 p
> rogram (via a script) it has to translate the coordinates into long/lat. In g
> dplot2 there is another transformation back to mercator to get the extent of
> the map. These two transformations, in mapserver to long/lat and in gdplot2 f
> rom long/lat to mercator, doesn't match.
>
>2. Mapserver uses the proj4-library for coordinate transformations and a specf
> ic transformation is configurable. When it comes to Mercator and proj 4 it's
> projection follows this formula (you can find it on several places, for examp
> le here:
>http://www.upcnet.es/~jgc2/docs/mercator.html):
>
>E = a Lo
>N = a * ln ( tan (pi/4 + L/2) * ( (1 - e * sin (L)) / (1 + e * sin (L))) ** (e
> /2) )
>
>Where
>
>L = latitude in radians (positive north)
>Lo = longitude in radians (positive east)
>E = easting (meters)
>N = northing (meters)
>ln() is the natural logarithm
>
>and
>
>For the Ellipsoid WGS84
>take:
>
>a = 6378137 (meters)
>e = 0.0818191913108718138
>
>
>a = Semi-Major Axis (Equatorial Radius)
> WGS84 = 6378137.0 meters
>b = Semi-Minor Axis (Polar Radius)
> WGS84 = 6356752.3142 meters
>f = Flattening
> f = (a-b)/a
> WGS84 = 1/298.257223563
>e = First Eccentricity
> e = sqrt(2*f-f^2)
> WGS84 = sqrt(0.00669437999013)
>
>3. The formula in 2) is for an ellipsoid. There is another mercator projection
> around. Its based on the earth as a sphere:
>
> E = r Lo
> N = r ln [ tan (pi/4 + L/2) ]
>
> where
>
> r = radius of the sphere (meters)
> ln() is the natural logarithm
>
>4 If I only knew exact which formula and parameters where used in gdplot2, the
> n the problem would be solved, since I could adopt the conversion in mapserve
> r to match the one in gdplot2.
>
>5 Would it be possible for you to tell me which of the formulas that are used
> in gdplot2 when you specify "MER/0;0;0/nm". Could you pls also tell me the ot
> her parameters (r for the sphere case, and a, f for the ellipsoid formula)
>
>Kind regards
>
>Bengt
>
>
>-----Ursprungligt meddelande-----
>Från: Unidata Support [mailto:address@hidden]
>Skickat: den 11 januari 2006 21:03
>Till: Nilsson Bengt
>Kopia: address@hidden
>Ämne: 20060110: Gempak - gdplot2 and mapserver projections
>
>
>
>Bengt,
>
>The CED in GEMPAK is a constant lat/lon. When you specify the
>margins to be 0, eg:
>PROJ = ced//0;0;0;0
>the plotted area will have no extraneous space, if your window size
>and GAREA have the same dimensions.
>
>For example,
>DEVICE = xw||900;700
>GAREA = 45;-125;52;-116
>or
>DEVICE = gf|outfile.gif|900;700
>
>The display window has a ratio of 9 to 7, and the garea in
>the above is 9 degrees wide and 7 degrees tall.
>
>You can specify the LATLON parameter, such as:
>LATLON = 1/1/1/1;1/.2;.2
>to verify that your specified garea corners are the corner of your display win
> dow.
>
>If your garea and device regions have different ratios, then the output displa
> y will
>have space filling one direction. The margins are extra space for titles and a
> xes
>in addition to the space needed to maintain a constant aspect ratio.
>
>Steve Chiswell
>Unidata User Support
>
>
>>From: "Bengt Nilsson" <address@hidden>
>>Organization: UCAR/Unidata
>>Keywords: 200601101057.k0AAv931004748
>
>>Institution: AerotechTelub
>>Package Version: GEMPAK5.9.1
>>Operating System: Linux (Novell OES 9)
>>Hardware Information: HP proliant DL380 G4
>>Inquiry: Hi,
>>
>>I\'m using GEMPAK5.9.1 and am trying to integrate gdplot2 images and mapserve
> r
>> .
>>
>>All other layers in (WMS)mapserver are using EPSG:4326. When I try to overlay
>
>> an gdplot2 image produced with the CED-projection (without margins) the gdpl
> o
>> t image doesn\'t align perfectly. It\'s a litte bit (fractions of degrees) o
> f
>> f, both in x- and y-direction (to the north-east).
>>
>>I guess that the problem is that the CED-projection used in gdplot2 is not ex
> a
>> ctly the same as in mapserver.
>>
>>In mapserver (as to the WMS-standard) the procedure to make a standard projec
> t
>> ion is as follows:
>>
>>\"7.3.5 Projection of geographic CRSs into Map CS
>>When the CRS parameter specifies a geographic coordinate reference system (su
> c
>> h as CRS:84 or
>>EPSG:4326), the spatial data is internally projected using the Pseudo Plate C
> a
>> rrée coordinate operation
>>method and thereafter transformed to an image coordinate reference system wit
> h
>> the i axis parallel and
>>proportional to longitude and the j axis parallel and proportional to latitud
> e
>> to enable direct screen rendering.
>>Because increments of latitude and longitude are both not consistent in linea
> r
>> terms, the image axes are then
>>of variable scale. The geographic information is projected during the portray
> a
>> l operation using a modified
>>equidistant cylindrical projection as follows:
>>
>>. The minimum and maximum values of longitude and latitude requested (min_lon
> ,
>> min_lat, max_lon,
>>max_lat) are determined from the BBOX parameter, taking into account the X an
> d
>> Y axis order specified by the CRS parameter.
>>
>>. The angular distance (max_lon - min_lon) in degrees is scaled to the number
>
>> of pixels specified by the WIDTH parameter.
>>
>>. The angular distance (max_lat - min_lat) in degrees is scaled to the number
>
>> of pixels specified by the HEIGHT parameter.
>>
>>. The map is produced with longitude parallel to the i axis and latitude para
> l
>> lel to the j axis.
>>\"
>>
>>How does that fit into the CED projection? Is there a way, via gdplot2 parame
> t
>> ers, to make them align?
>>
>>Regards Bengt
>>
>>Ps. It would have been nice if this could work since I\'ve seen that there ar
> e
>> many people out there who wants to integrate gridded data into mapserver.
>>
>>
>>
>--
>**************************************************************************** <
>Unidata User Support UCAR Unidata Program <
>(303)497-8643 P.O. Box 3000 <
>address@hidden Boulder, CO 80307 <
>---------------------------------------------------------------------------- <
>Unidata WWW Service http://my.unidata.ucar.edu/content/support <
>---------------------------------------------------------------------------- <
>NOTE: All email exchanges with Unidata User Support are recorded in the
>Unidata inquiry tracking system and then made publicly available
>through the web. If you do not want to have your interactions made
>available in this way, you must let us know in each email you send to us.
>
--
**************************************************************************** <
Unidata User Support UCAR Unidata Program <
(303)497-8643 P.O. Box 3000 <
address@hidden Boulder, CO 80307 <
---------------------------------------------------------------------------- <
Unidata WWW Service http://my.unidata.ucar.edu/content/support <
---------------------------------------------------------------------------- <
NOTE: All email exchanges with Unidata User Support are recorded in the
Unidata inquiry tracking system and then made publicly available
through the web. If you do not want to have your interactions made
available in this way, you must let us know in each email you send to us.