[Featureserver] Displaying a ogr or postgis datasource as a layer
david creane
dc at openapp.ie
Wed Oct 3 10:25:13 EDT 2007
I am trying to add a data source from a .shp file and from a postgis
datasource as a layer but im not sure how to get either of them working.
my featureserver.cfg file contains
.......
[luas_tallaght]
type=OGR
dsn=luas_tallaght.shp
layer=luas_tallaght
[ire_logi2]
type=OGR
dsn=ire_logi2.shp
layer=ire_logi2
[super_eds]
type=PostGIS
dsn=dbname=hai
layer=super_eds
fid=gid
geometry=the_geom
srid=29900
[hospital]
type=PostGIS
dsn=dbname=hai
layer=hospital
fid=gid
geometry=the_centroid
srid=29900
....
the javascript contains
.....
map = new OpenLayers.Map('map', mapParams, mapOptions);
blayer = new OpenLayers.Layer.WMS( "Test",
"http://localhost/~dave/tilecache/tilecache.cgi?", {layers:
'ireland_coast_permanent',format: 'image/png'}, eireBaseOptions );
map.addLayer(blayer);
var wfs = new OpenLayers.Layer.WFS("WFS",
"http://localhost/~dave/featureserver/featureserver.cgi/hospital?format=WFS",
{typename: "Point", geometry_column: 'the_centroid'}, {});
map.addLayer(wfs);
var wfs2 = new OpenLayers.Layer.WFS("WFS",
"http://localhost/~dave/featureserver/featureserver.cgi/luas_tallaght?format=WFS",
{typename: "LineString"}, {});
map.addLayer(wfs2);
....
All that gets displayed is the base layer. The 2 wfs layers dont. Also the
postgis database is not being called at all but if i call
http://localhost/~dave/featureserver/featureserver.cgi/hospital?format=WFS
through the browser on its own i do get a response from the database, for
example
{"type": "FeatureCollection", "members": [{"geometry": {"type": "Point",
"coordinates": [99771.29, 47991.03]}, "type": "Feature", "id": 1,
"properties": {"no_of_beds": ...................................
Can anyone tell me what im doing wrong.
thanks dave
More information about the Featureserver
mailing list