[Proj] Mapserver Projection Issue
Stephen Woodbridge
woodbri at swoodbridge.com
Thu Jan 2 13:28:04 PST 2014
Ok, I fix this by loading the shapefile into postgis and running this query:
update world set geom=st_intersection(geom,
st_transform(st_setsrid('POLYGON((-20037508.34 -20037508.34,-20037508.34
20037508.34,20037508.34 20037508.34,20037508.34
-20037508.34,-20037508.34 -20037508.34))'::geometry, 3857), 4326)) where
gid in (220,222,235);
It turns out that these three polygons had extents that exceeded lat
and/or long maximum extents for spherical Mercator:
world=# select gid, st_astext(geom) from ( select gid,
st_astext(st_extent(geom)
gid |
-----+--------------------------------------------------------------------------
220 | POLYGON((-180.000014999871 -90.0000149996579,-180.000014999871
-60.492514 ...
222 | POLYGON((-180.000014999871 -21.0273150004093,-180.000014999871
-12.457514 ...
235 | POLYGON((-180.000014999871 41.1888849995916,-180.000014999871
81.86168499 ...
(3 rows)
It is not clear why this worked on 4.6.0 and not on 4.8.0 !!!
http://imaptools.com:8080/cgi-bin/mapserv?MAP=%2Fu%2Fdata%2Fworld%2Fworld.map&FORMAT=image%2Fpng&LAYERS=World_WMS&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A900913&BBOX=-27395030.9325,-21524667.16125,27395030.9325,21524667.16125&WIDTH=700&HEIGHT=550
Works after intersecting with the max bbox for spherical Mercator and
dumping it back to a shapefile.
Thanks to Richard for his help debugging this.
-Steve
On 1/2/2014 1:54 PM, Richard Greenwood wrote:
>
> On Thu, Jan 2, 2014 at 11:30 AM, Stephen Woodbridge
> <woodbri at swoodbridge.com <mailto:woodbri at swoodbridge.com>> wrote:
>
> On 1/2/2014 10:21 AM, Richard Greenwood wrote:
> > Steve,
> >
> > Replying off list, for what it's worth I'm seeing the same issue with
> > your data on Ubutu 12.04, Proj 4.8, mapserv 6.2.1 built from
> source. I
> > rarely use web mercator in my work so I have limited experience
> with it
> > and limited data. I notice that ogrinfo on your world_disolve
> reports:
> > Extent: (-180.000015, -90.000015) - (179.999985, 83.633385)
>
> Hmmm, these values might be a problem: -180.000015, -90.000015
> I'll load that into postgis and see if I can fiddle with these and if
> that makes a difference.
>
> Thank you for your time and effort.
>
> > Have you tested with any other data?
>
> I got similar results using the Natural Earth data.
>
>
>
> Did you see my second reply (which actually was off list)? I think the
> problem is in the data because with just the USA & Canada it rendered
> correctly but adding Russia and Greenland caused the rendering issues to
> reappear.
>
> Keep us posted.
>
> Rich
>
>
>
> > On Thu, Jan 2, 2014 at 7:43 AM, Stephen Woodbridge
>
> > <woodbri at swoodbridge.com <mailto:woodbri at swoodbridge.com>
> <mailto:woodbri at swoodbridge.com <mailto:woodbri at swoodbridge.com>>>
> wrote:
> >
> > On 1/2/2014 9:13 AM, Richard Greenwood wrote:
> > > Are you sure that it's finding and using the correct epsg
> file? You
> > > could specify the full path to an epsg file in either the
> mapfile
> > or the
> > > apache conf, or paste the proj parameters into the PROJ
> block in the
> > > mapfile and do away wit the epsg file completely.
> >
> > It is a clean new system with only the Ubuntu package
> installed. I added
> > 900913 to the /usr/share/proj/epsg file. I also just modified the
> > mapfile and entered the projection parameters in it directly
> as you
> > suggested with the same result.
> >
> > If you want to try this, download
> http://imaptools.com:8080/dl/world.tbz
> > It resides in directory /u/data/ on my system so you would
> need to
> > adjust the paths appropriately.
> >
> > I've now spent 3 days fussing with this and trying to debug it. I
> > suppose the next thing to try is to build proj4-4.6.0 on the
> Ubuntu
> > system and see if that resolves the issue.
> >
> > Thanks,
> > -Steve
> >
> > Here is the mapfile:
> >
> > MAP
> > NAME "World_WMS"
> > STATUS ON
> > SIZE 800 800
> > #EXTENT -180 -90 180 90
> > EXTENT -20037508.34 -20037508.34 20037508.34 20037508.34
> > UNITS DD
> > SHAPEPATH "/u/data/world/"
> > IMAGECOLOR "#80B1D3"
> > FONTSET "/u/data/world/fontset.txt"
> > IMAGETYPE "agg_qn"
> > MAXSIZE 4000
> >
> > CONFIG MS_ERRORFILE "stderr"
> > CONFIG ON_MISSING_DATA "IGNORE"
> > #DEBUG 10
> >
> > OUTPUTFORMAT
> > NAME "agg_qn"
> > DRIVER "AGG/PNG"
> > EXTENSION "png"
> > MIMETYPE "image/png"
> > IMAGEMODE RGB
> > FORMATOPTION "INTERLACE=false"
> > FORMATOPTION "QUANTIZE_NEW=ON"
> > FORMATOPTION "QUANTIZE_FORCE=ON"
> > FORMATOPTION "QUANTIZE_DITHER=OFF"
> > FORMATOPTION "QUANTIZE_COLORS=256"
> > END
> >
> > OUTPUTFORMAT
> > NAME aggpng24
> > DRIVER AGG/PNG
> > MIMETYPE "image/png"
> > IMAGEMODE RGB
> > EXTENSION "png"
> > END
> >
> > WEB
> > METADATA
> > "labelcache_map_edge_buffer" "-20"
> > "ows_title" "World_WMS"
> > "ows_onlineresource"
> >
> "http://imaptools.com:8080/cgi-bin/mapserv?map=/u/data/world/world.map&"
> > "ows_srs" "EPSG:4326 EPSG:900913 EPSG:4269 EPSG:3857"
> > "ows_feature_info_mime_type" "text/html"
> > "ows_enable_request" "GetMap"
> > "ows_contactperson" "Stephen Woodbridge"
> > "ows_contactorganization" "iMaptools.com"
> > "ows_contactposition" "Owner"
> > "ows_contactelectronicmailaddress"
> "info at imaptools.com <mailto:info at imaptools.com>
> > <mailto:info at imaptools.com <mailto:info at imaptools.com>>"
> > "ows_attribution_title" "Data copyright by LeadDog
> > Consulting."
> > END
> > END
> >
> > # PROJECTION "init=epsg:4326" END
> > PROJECTION "+proj=lcc +lat_1=17.5 +lat_2=29.5 +lat_0=12
> +lon_0=-102
> > +x_0=2500000 +y_0=0 +datum=WGS84 +units=m +no_defs" END
> >
> > LAYER
> > STATUS DEFAULT
> > TYPE POLYGON
> > PROJECTION "init=epsg:4326" END
> > FEATURE
> > POINTS -180 -90 -180 90 180 90 180 -90 -180 -90 END
> > END
> > CLASS
> > STYLE
> > COLOR "#80B1D3"
> > END
> > END
> > END
> >
> > LAYER
> > NAME "World"
> > GROUP "cb"
> > METADATA
> > ows_title "World"
> > ows_group_title "Land Mass"
> > END
> > STATUS ON
> > PROJECTION "init=epsg:4326" END
> > TYPE POLYGON
> > DATA "world_dissolve"
> > CLASS
> > STYLE
> > COLOR "#CACACA"
> > OUTLINECOLOR "#888888"
> > END
> > END
> > END
> >
> > END
> >
> >
> > > Rich
> > >
> > >
> > > On Wed, Jan 1, 2014 at 9:47 AM, Stephen Woodbridge
> > > <woodbri at swoodbridge.com <mailto:woodbri at swoodbridge.com>
> <mailto:woodbri at swoodbridge.com <mailto:woodbri at swoodbridge.com>>
> > <mailto:woodbri at swoodbridge.com
> <mailto:woodbri at swoodbridge.com> <mailto:woodbri at swoodbridge.com
> <mailto:woodbri at swoodbridge.com>>>>
> > wrote:
> > >
> > > Hi All,
> > >
> > > I'm trying to run down a mapserver projection issue
> that is
> > starting to
> > > look like it might be the version of proj4. Sorry for the
> > cross posting.
> > >
> > > Situation:
> > >
> > > I'm upgrading my server from Debian Lenny to Ubuntu
> 12.04 LTS
> > and world
> > > maps on the Ubuntu system projected to Spherical
> Mercator are
> > messed up
> > > and worked fine on Debian. I get the same issue using
> > mapserver 6.2.1 or
> > > 5.6.8 and the big difference other than the OS and
> packages
> > is that
> > > Ubuntu is using proj4-4.8.0 and the older Debian
> system is using
> > > proj4-4.6.0
> > >
> > > Is this a known issue? I can make the data mapfile
> available
> > if that
> > > helps.
> > >
> > > System details below.
> > >
> > > Any help would be appreciated.
> > >
> > > Thanks,
> > > -Steve
> > >
> > > Ubuntu system:
> > >
> > >
> >
> http://imaptools.com:8080/cgi-bin/mapserv?MAP=%2Fu%2Fdata%2Fworld%2Fworld.map&FORMAT=image%2Fpng&LAYERS=World_WMS&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A900913&BBOX=-27395030.9325,-21524667.16125,27395030.9325,21524667.16125&WIDTH=700&HEIGHT=550
> > >
> > > /u/www/cgi-bin/mapserv -v
> > > MapServer version 6.2.1 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG
> > SUPPORTS=PROJ
> > > SUPPORTS=GD SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=CAIRO
> > > SUPPORTS=SVG_SYMBOLS SUPPORTS=ICONV SUPPORTS=FRIBIDI
> > SUPPORTS=WMS_SERVER
> > > SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER
> SUPPORTS=WFS_CLIENT
> > > SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=FASTCGI
> > > SUPPORTS=THREADS SUPPORTS=GEOS INPUT=JPEG
> INPUT=POSTGIS INPUT=OGR
> > > INPUT=GDAL INPUT=SHAPEFILE
> > >
> > > libproj-dev/precise uptodate 4.8.0-3~precise2
> > > libproj0/precise uptodate 4.8.0-3~precise2
> > > proj-bin/precise uptodate 4.8.0-3~precise2
> > > proj-data/precise uptodate 4.8.0-3~precise2
> > >
> > > # Spherical Mercator projection
> > > <900913> +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0
> +lon_0=0.0
> > > +x_0=0.0 +y_0=0 +k=1.0 +units=m +over +nadgrids=@null
> > +no_defs <>
> > >
> > >
> > > cgi-mapserver/precise uptodate 6.2.1-2~precise3
> > > libmapserver/precise uptodate 6.2.1-2~precise3
> > > mapserver-bin/precise uptodate 6.2.1-2~precise3
> > >
> > > Linux mappy 3.8.0-33-generic #48~precise1-Ubuntu SMP
> Thu Oct
> > 24 16:28:06
> > > UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
> > >
> > > I also get the same result from:
> > >
> > > /u/www/cgi-bin/mapserv-56 -v
> > > MapServer version 5.6.8 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG
> > OUTPUT=WBMP
> > > OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE
> > SUPPORTS=ICONV
> > > SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT
> > > SUPPORTS=WFS_SERVER INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR
> > INPUT=GDAL
> > > INPUT=SHAPEFILE
> > >
> > > which was built from source also using the libproj
> packages
> > above.
> > >
> > > Debian Lenny system:
> > >
> > >
> >
> http://gis.imaptools.com/cgi-bin/mapserv-6.2?MAP=%2Fu%2Fdata%2Fworld%2Fworld.map&FORMAT=image%2Fpng&LAYERS=World_WMS&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A900913&BBOX=-27395030.9325,-21524667.16125,27395030.9325,21524667.16125&WIDTH=700&HEIGHT=550
> > >
> > > proj/lenny uptodate 4.6.0-2
> > >
> > > # Spherical Mercator - Google
> > > <900913> +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0
> +lon_0=0.0
> > > +x_0=0.0 +y_0=0 +k=1.0 +units=m +over +nadgrids=@null
> > +no_defs <>
> > >
> > >
> > > Linux gis.leaddog.com <http://gis.leaddog.com>
> <http://gis.leaddog.com>
> > <http://gis.leaddog.com> 2.6.32-042stab081.8
> > > #1 SMP Wed Oct 23 16:32:28 MSK
> > > 2013 x86_64 GNU/Linux
> > >
> > > I built mapserver from source and I also get the same
> result from
> > > mapserver-5.6.8 built from source.
> > >
> > > _______________________________________________
> > > Proj mailing list
> > > Proj at lists.maptools.org <mailto:Proj at lists.maptools.org>
> <mailto:Proj at lists.maptools.org <mailto:Proj at lists.maptools.org>>
> > <mailto:Proj at lists.maptools.org
> <mailto:Proj at lists.maptools.org> <mailto:Proj at lists.maptools.org
> <mailto:Proj at lists.maptools.org>>>
> > > http://lists.maptools.org/mailman/listinfo/proj
> > >
> > >
> > >
> > >
> > > --
> > > Richard Greenwood
> > > richard.greenwood at gmail.com
> <mailto:richard.greenwood at gmail.com>
> <mailto:richard.greenwood at gmail.com
> <mailto:richard.greenwood at gmail.com>>
> > <mailto:richard.greenwood at gmail.com
> <mailto:richard.greenwood at gmail.com>
> > <mailto:richard.greenwood at gmail.com
> <mailto:richard.greenwood at gmail.com>>>
> > > www.greenwoodmap.com <http://www.greenwoodmap.com>
> <http://www.greenwoodmap.com>
> > <http://www.greenwoodmap.com>
> > >
> > >
> > > _______________________________________________
> > > Proj mailing list
> > > Proj at lists.maptools.org <mailto:Proj at lists.maptools.org>
> <mailto:Proj at lists.maptools.org <mailto:Proj at lists.maptools.org>>
> > > http://lists.maptools.org/mailman/listinfo/proj
> > >
> >
> > _______________________________________________
> > Proj mailing list
> > Proj at lists.maptools.org <mailto:Proj at lists.maptools.org>
> <mailto:Proj at lists.maptools.org <mailto:Proj at lists.maptools.org>>
> > http://lists.maptools.org/mailman/listinfo/proj
> >
> >
> >
> >
> > --
> > Richard Greenwood
> > richard.greenwood at gmail.com <mailto:richard.greenwood at gmail.com>
> <mailto:richard.greenwood at gmail.com
> <mailto:richard.greenwood at gmail.com>>
> > www.greenwoodmap.com <http://www.greenwoodmap.com>
> <http://www.greenwoodmap.com>
> >
> >
> > _______________________________________________
> > Proj mailing list
> > Proj at lists.maptools.org <mailto:Proj at lists.maptools.org>
> > http://lists.maptools.org/mailman/listinfo/proj
> >
>
> _______________________________________________
> Proj mailing list
> Proj at lists.maptools.org <mailto:Proj at lists.maptools.org>
> http://lists.maptools.org/mailman/listinfo/proj
>
>
>
>
> --
> Richard Greenwood
> richard.greenwood at gmail.com <mailto:richard.greenwood at gmail.com>
> www.greenwoodmap.com <http://www.greenwoodmap.com>
>
>
> _______________________________________________
> Proj mailing list
> Proj at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/proj
>
More information about the Proj
mailing list