[mapserver-users] Cannot read shp file from database

Jeremy JK jason2017jay at gmail.com
Mon Mar 28 11:59:57 PDT 2022


Thanks!


On Mon, Mar 28, 2022 at 2:52 PM Seth G <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
> 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
>
>
> *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
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20220328/e3bccb2e/attachment.html>


More information about the MapServer-users mailing list