[mapserver-users] Cannot read shp file from database

Scott public at postholer.com
Mon Mar 28 13:52:22 PDT 2022


I think the srid should be 900913 and actually it should probably be 3857.


On 3/28/22 11:59, Jeremy JK wrote:
> Thanks!
> 
> 
> On Mon, Mar 28, 2022 at 2:52 PM Seth G <sethg at geographika.co.uk 
> <mailto:sethg at geographika.co.uk>> wrote:
> 
>     __
>     Hi,
> 
>     The following 3 lines should all be in your LAYER...END block (and
>     replacing the current DATA line):
> 
>        CONNECTIONTYPE postgis
>        CONNECTION "user=postgres password=StrongAdminP at ssw0rd
>     dbname=news_test_shp host=127.0.0.1 port=5432"
>        DATA "geom from sample.admintable using unique gid using
>     srid=9000913"
> 
> 
>     Seth
>     --
>     web:https://geographika.net <https://geographika.net>
>     twitter: @geographika
> 
> 
>     On Mon, Mar 28, 2022, at 8:29 PM, Jeremy JK wrote:
>>     Hello all,
>>     On my virtualbox linuxmint machine I can view a shp file with
>>     MapServer when the shp file is on filesystem.
>>     When I put it into the database, the browser returns an error message
>>     but ogrinfo program can read the database well.
>>     See below
>>
>>     And thanks for your assistance
>>     J
>>
>>     *Error*: msLoadMap(): Unknown identifier. Parsing error near
>>     (CONNECTIONTYPE):(line 9)
>>     *Petition*:
>>     http://localhost:8080/cgi-bin/mapserv?map=/opt/mapfile/mapserver_quickstart.map&SERVICE=WMS&REQUEST=Getmap&VERSION=1.1.1&LAYERS=Countries&SRS=EPSG:4326&BBOX=-137,29,-53,88&FORMAT=PNG&WIDTH=800&HEIGHT=600
>>     <http://localhost:8080/cgi-bin/mapserv?map=/opt/mapfile/mapserver_quickstart.map&SERVICE=WMS&REQUEST=Getmap&VERSION=1.1.1&LAYERS=Countries&SRS=EPSG:4326&BBOX=-137,29,-53,88&FORMAT=PNG&WIDTH=800&HEIGHT=600>
>>
>>
>>     *ogrinfo *PG:"host=127.0.0.1 user=postgres
>>     password=StrongAdminP at ssw0rd dbname=news_test_shp port=5432"
>>     sample.admintable -summary
>>     INFO: Open of `PG:host=127.0.0.1 user=postgres
>>     password=StrongAdminP at ssw0rd dbname=news_test_shp port=5432'
>>           using driver `PostgreSQL' successful.
>>
>>     Layer name: sample.admintable
>>     Geometry: Multi Polygon
>>     Feature Count: 258
>>     Extent: (-180.000000, -90.000000) - (180.000000, 83.634101)
>>     Layer SRS WKT:
>>     GEOGCRS["WGS 84",
>>         DATUM["World Geodetic System 1984",
>>             ELLIPSOID["WGS 84",6378137,298.257223563,
>>                 LENGTHUNIT["metre",1]]],
>>         PRIMEM["Greenwich",0,
>>             ANGLEUNIT["degree",0.0174532925199433]],
>>         CS[ellipsoidal,2],
>>             AXIS["geodetic latitude (Lat)",north,
>>                 ORDER[1],
>>                 ANGLEUNIT["degree",0.0174532925199433]],
>>             AXIS["geodetic longitude (Lon)",east,
>>                 ORDER[2],
>>                 ANGLEUNIT["degree",0.0174532925199433]],
>>         ID["EPSG",4326]]
>>     Data axis to CRS axis mapping: 2,1
>>     ...
>>
>>     +++++++++++++++++++++++++++++++++++++++++++++++++++
>>     *MAP*
>>       NAME "MAPSERVER_QUICKSTART"
>>       EXTENT -137 29 -53 88
>>       UNITS DD
>>       SHAPEPATH "/opt/mapfile"
>>       SIZE 800 600
>>
>>       IMAGETYPE PNG24
>>       CONNECTIONTYPE postgis
>>       CONNECTION "user=postgres password=StrongAdminP at ssw0rd
>>     dbname=news_test_shp host=127.0.0.1 port=5432"
>>       DATA "geom from sample.admintable using unique gid using
>>     srid=9000913"
>>
>>
>>       PROJECTION
>>         "init=epsg:4326"
>>       END
>>
>>       WEB
>>         METADATA
>>           ows_title "MapServer Quickstart"
>>           ows_enable_request "*"
>>           ows_srs "EPSG:4326 EPSG:25832 EPSG:25833"
>>         END
>>       END
>>
>>       LAYER
>>         NAME "Countries"
>>         STATUS ON
>>         TYPE POLYGON
>>         DATA "ne_10m_admin_0_countries"
>>         CLASS
>>           STYLE
>>             COLOR 246 241 223
>>             OUTLINECOLOR 0 0 0
>>           END
>>         END
>>       END
>>
>>     END
>>     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>     _______________________________________________
>>     MapServer-users mailing list
>>     MapServer-users at lists.osgeo.org
>>     <mailto:MapServer-users at lists.osgeo.org>
>>     https://lists.osgeo.org/mailman/listinfo/mapserver-users
>>     <https://lists.osgeo.org/mailman/listinfo/mapserver-users>
>>
> 
> 
> _______________________________________________
> MapServer-users mailing list
> MapServer-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users


More information about the MapServer-users mailing list