[mapserver-users] still have problem when add postgis layer on mapserver mapfile

Rahkonen Jukka Jukka.Rahkonen at mmmtike.fi
Sun Aug 26 14:22:49 PDT 2012


Hi,

- This may be a typo:
NAME "places1"
 DATA "geometry from osm_new_mainroads using unique osm_id using srid 3785"
 TYPE POINT
Or do you really have your places are in osm_new_mainroads table.

- Then it is a good habit to have PROJECTION block in both the MAP block and for each LAYER.
- It is also a good habit to use DEBUG 5 and see what you get into the block
- shp2img is better for testing than a browser but mode=map is OK too. Remember to set layers to default (as you had) or give layer names with &layers= parameter
- Finally, I think it would be good to add STYLE into your layer, inside CLASS.

See the "Very basic WMS Server mapfile" example at the bottom of page http://mapserver.org/ogc/wms_server.html
It should be OK. Perhaps it could be even a bit more simple because now it has a reference to a symbolset file. A very, very basic mapfile should be made to work without external symbols.

-Jukka Rahkonen-


________________________________
 李杨 [gisyangli] wrote:

> I try to load a postgis data layer on my mapfile, have problem when configure the mapfile done, then visit it using "http://127.0.0.1/cgi-bin/mapserv?&map=/var/www/osm-google.map&mode=map&mode=map" on the browser address. , only a blank blue image return, with no expected dot info.

> I can not figure out which step is have problem.

> Provide background info:

ogrinfo for the database  table:

jack at jack-Vostro-1450:/usr/lib/cgi-bin$ ogrinfo PG:"host=127.0.0.1 user=osm  password=osm dbname=osm port=5432" osm_new_mainroads -summary
INFO: Open of `PG:host=127.0.0.1 user=osm  password=osm dbname=osm port=5432'
      using driver `PostgreSQL' successful.

Layer name: osm_new_mainroads
Geometry: Line String
Feature Count: 9704
Extent: (-9871463.421196, 3533052.471384) - (-9460289.228784, 4190971.740014)
Layer SRS WKT:
PROJCS["Popular Visualisation CRS / Mercator (deprecated)",
    GEOGCS["Popular Visualisation CRS",
        DATUM["Popular_Visualisation_Datum",
            SPHEROID["Popular Visualisation Sphere",6378137,0,
                AUTHORITY["EPSG","7059"]],
            TOWGS84[0,0,0,0,0,0,0],
            AUTHORITY["EPSG","6055"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.01745329251994328,
            AUTHORITY["EPSG","9122"]],
        AUTHORITY["EPSG","4055"]],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    PROJECTION["Mercator_1SP"],
    PARAMETER["central_meridian",0],
    PARAMETER["scale_factor",1],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    AUTHORITY["EPSG","3785"],
    AXIS["X",EAST],
    AXIS["Y",NORTH]]
FID Column = id
Geometry Column = geometry
osm_id: Integer (0.0)
name: String (255.0)
type: String (255.0)
tunnel: Integer (5.0)
bridge: Integer (5.0)
oneway: Integer (5.0)
ref: String (255.0)
z_order: Integer (5.0)
jack at jack-Vostro-1450:/usr/lib/cgi-bin$

--------------------------------------------------------------------------------------------
.map(uing in the link above : osg-google.map) info for configure:

MAP
NAME places1
STATUS ON
SIZE 800 800
EXTENT -9871463.421196 3533052.471384 -9460289.228784 4190971.740014
UNITS meters
IMAGECOLOR 153 179 204


WEB
    IMAGEPATH "/var/www/output"
    IMAGEURL "/output/"
END

LAYER
 STATUS DEFAULT
 NAME "places1"
 DATA "geometry from osm_new_mainroads using unique osm_id using srid 3785"
 TYPE POINT
 CONNECTIONTYPE postgis
 CONNECTION "host=localhost dbname=osm user=osm password=osm port=5432"
 CLASS
NAME "places1_color"
COLOR 255 215 0
  END
END

END

-------------------------
for a explanation , whenever set  "DATA "geometry from osm_new_mainroads using unique osm_id using srid 3785"",
DATA "geometry from osm_new_mainroads", or
DATA "geometry from osm_new_mainroads using unique osm_id using srid 3875

is the same , a blank image return
-------------------------------------------------------
massperv version info:

./mapserv -v
MapServer version 6.0.3 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=GEOS INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE



I try to experiment it in two different laptop and can not get expected result.

Please those with experience help me., this problem qurrall  me a lot this weeked.

Thanks a lot.


--
Yang Li
GIS Developer
P.R.China




More information about the MapServer-users mailing list