[mapserver-users] working with ESRI coordinate systems in proj.db
Richard Greenwood
richard.greenwood at gmail.com
Sat Jan 8 18:20:15 PST 2022
Mark,
Rather than use the proj.db to look up an ESRI or EPSG code you could try
explicitly defining your source coordinate system. There's an example here:
https://mapserver.org/mapfile/projection.html
You can also edit, or create your own epsg file. In fact, that used to be a
recommended optimization so that proj didn't have to parse a big long epsg
file. It's just an ASCII text file. On a Linux computer the default
location is in /usr/share/proj/.
And as a test, on the server where you're running MapServer, can you do
something like:
ogr2ogr out.shp source.shp -t_srs epsg:3857
This would tell you if the installed gdal and proj libraries recognise the
coordinate system of the source.shp file. Or simpler still, ogrinfo
source.shp and see if the coordinate system is identified.
If you don't have a .prj file accompanying your source.shp you can declare
the source coordinate system with -s_srs esri:103749 or possibly -s_srs
epsg:103749 which might give you some clues as to what's working and not
working on your computer.
Rich
On Fri, Jan 7, 2022 at 8:26 AM Mark Volz <MarkVolz at co.lyon.mn.us> wrote:
> Hello,
>
>
>
> I apologize please ignore my mention of EPSG 4326. My end result is a WMS
> map in Web Mercator 3857. My underlying data is stored in a shapefile that
> is in WKID 103749 which is a projection has already been included in
> proj.db as ESRI as the authority . The underlying map application is
> using javascript. I know that my map is finding proj.db because it
> MapServer does not complain when I convert UTM 14 to Web Mercator… but
> that does not help because the underlying data is not in UTM 14.
>
>
>
> Here is how I have the projections of my map is set up:
>
> MAP
>
> PROJECTION
>
> "init=epsg:3857"
>
> END #end map projection
>
> LAYER
>
> DATA 'ParcelsLyon.shp'
>
> PROJECTION
>
> "init=epsg:103749" #Error: proj_create: cannot expand
> init=espg:103749 type=crs
>
> "init=crs:103749" # Error: proj_create: cannot expand
> init=crs:103749 type=crs
>
> "init=ESRI:103749" #Error: proj_create: cannot expand
> init=esri:103749 type=crs
>
> "init=epsg:26914" #MapServer does not warn about any errors, but of
> course nothing draws because my data is in a different projection
>
> END #layer projection
>
> END #end layer
>
> END #end map
>
>
>
> Example request
>
>
> http://localhost/cgi-bin/mapserv.exe?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&FORMAT=image%2Fpng&TRANSPARENT=true&LAYERS=parcels%2CCityLimits%2CTownships&MAP=%2Fms4w%2Fapps%2Flyondata%2F.%2Fmaps%2Falllayers%2FAllLayers.map&SRS=EPSG%3A3857&STYLES=&WIDTH=1569&HEIGHT=912&BBOX=-10678090.52943604%2C5544408.3738651555%2C-10668156.653791208%2C5550182.55779638
>
>
>
>
>
> @Bob
>
> I could project my shapefile into any projection. However, I will hit a
> wall with my raster layers which I prefer not to project at this time.
>
>
>
> Thanks!
>
>
>
>
>
> *From:* artclifford at gmail.com <artclifford at gmail.com>
> *Sent:* Thursday, January 6, 2022 7:19 PM
> *To:* Mark Volz <MarkVolz at co.lyon.mn.us>
> *Subject:* RE: [mapserver-users] working with ESRI coordinate systems in
> proj.db
>
>
>
> It’s a little unclear to me what you are attempting.
>
> A mapfile can be defined where the map’s projection is EPSG:3857 (web
> mercator) set in a projection block at the map level, and your layer
> definition can have a projection block set to whatever projection you are
> using. That tells the map to render in web Mercator but says what
> projection your layer is stored in so that map server knows when to
> reproject stuff. I think you know that, but I’m just covering the “is it
> plugged in” issues and to suggest making sure the right projections are in
> the right projection blocks.
>
>
>
> Although not quite the problem you are having yet, epsg:4326 is wgs84
> lat/lon. Web Mercator is: EPSG:3857.
>
>
>
> If I remember correctly the projection can be defined for a mapfile
> projection block using the proj code definition if not the ESPG/numeric
> code. If that works, it might mean that MapServer isn’t using the proj.db
> file like you expect. Or if it is using a proj.db file it may be located
> elsewhere. Whether putting the whole proj definition is viable for your
> ultimate use it would at least identify the problem.
>
>
>
> Then there’s a question of access. How are you “accessing” things? Are you
> using WFS? Or are you using a python/php/other script? Are things stored in
> a shp file or postgis or other database?
>
>
>
> If you are using wfs are you passing the desired projection on the
> request? Also, are you defining the allowed wms/wfs projections?
>
>
>
> I’m not sure how much I personally can be of help, but any further context
> on your setup and what you are attempting that you are free and willing to
> provide will help folks here narrow down the possibilities.
>
>
>
>
>
>
>
>
>
> *From:* MapServer-users <mapserver-users-bounces at lists.osgeo.org> *On
> Behalf Of *Mark Volz
> *Sent:* Thursday, January 6, 2022 9:19 AM
> *To:* mapserver-users at lists.osgeo.org
> *Subject:* [mapserver-users] working with ESRI coordinate systems in
> proj.db
>
>
>
> Hello,
>
>
>
> Could someone help me with setting up MapServer to use a non ESRI
> projection that is already stored in proj.db? The coordinate system is for
> Lyon County, MN #103749 and is stored with ESRI as the authority. I know
> that we can set up MapServer to use Web Mercator by setting the adding
> "init=epsg:4326" to a projection block. Unfortunately I cannot access my
> counties coordinate system by setting the projection with
> “init=esri:103749”.
>
>
>
> Thank you for any help!
>
>
>
> Sincerely,
>
> *Mark Volz, GISP*
>
>
> _______________________________________________
> MapServer-users mailing list
> MapServer-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
>
--
Richard W. Greenwood
www.greenwoodmap.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20220108/4dad7770/attachment.htm>
More information about the MapServer-users
mailing list