[FWTools] Problem reprojecting from EPSG:4326 to EPSG:900913
Roger André
randre at gmail.com
Mon Oct 20 14:37:34 EDT 2008
Hi Everyone,
I'm having some issues when reprojecting data via a WMS request to
MapServer. While I realize this only touches on the gdal side of things
slightly (I'm using the gdal driver and FWTools version 2.0.6 in Linux), I'm
hoping the problem is one that someone on this list may have encountered.
Very briefly, here's what's happening. I have an image file that is
completely unprojected, and which spans a global extent in pixels that are
.025 x .025 degrees in size. I have assigned this file an SRS of EPSG:4326,
and am trying to display it with an SRS of 900913 in Google Maps. The
reprojection seems to work, at least in that the edges of the data set line
up correctly with all of the features in Google Maps, but there are
horizontal lines across my data in various places. When I replicate the WMS
call for one of these bad tiles,
http://localhost/cgi-bin/mapserv?
map=/var/www/mapfiles/test_20m/test.map
&layers=imagery
&srs=EPSG%3A900913
&version=1.1.1
&bbox=-20037508.34%2C-20037508.34%2C-10018754.1704%2C-10018754.1704
&service=WMS
&width=256
&styles=
&format=image%2Fpng
&request=GetMap
&height=256
I get back an image that is 256 x 256 pixels, but where the bottom 4 rows of
pixels are essentially empty (they're filled with the MapServer background
color). The pixels that are correctly represented are also stretched a bit
in the Y-axis as well. If I screw around with my projection definition for
EPSG:900913 and add an ellipsoid definition, +ellps=WGS84, the missing 4
pixels will be correctly rendered in this particular example, but if I look
closely at other parts of the data, in other zoom levels, the same problem
reappears.
I've also tried reprojecting the data to EPSG:900913 first, and then
displaying the data in Google Maps without making any sort of reprojection
request. What I get then from the image request above is a tile that is
filled 2/3 with correctly sized pixels (no y-axis stretch), and 1/3 is
empty. So I'm guessing that my definition of Google's projection is not
correct, but I have no clue how to fix it. I've used the definition found
at http://spatialreference.org/ref/user/google-projection/, and also at
http://trac.openlayers.org/wiki/SphericalMercator.
<900913> +proj=merc +ellps=WGS84 +a=6378137 +b=6378137 +lat_ts=0.0
+lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs <>
It seems pretty well researched at both of these sites, but I have never
seen the "+nadgrids=@null" parameter before. I've read the info about it at
http://proj.maptools.org/faq.html, but don't fully understand it.
Thanks in advance for any help or advice you can give me.
Roger
--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/fwtools/attachments/20081020/0bc0d3f0/attachment.html
More information about the FWTools
mailing list