[Featureserver] Displaying a ogr or postgis datasource as a layer

Christopher Schmidt crschmidt at metacarta.com
Wed Oct 3 13:15:01 EDT 2007


On Wed, Oct 03, 2007 at 03:25:13PM +0100, david creane wrote:
> 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.
> 
> 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.

It depends.

1. http://localhost/~dave/featureserver/featureserver.cgi/hospital?format=WFS
   This should give you GML, not JSON. If it's not doing that, there's a
   bug somewhere, and we'll need to investigate that. 
2. Specifying a typename overrides the layername in the URL. You should
   not send a typename if you are specifying the layer in the URL --
   dropping that might help things.. 
3. You should get Firebug or some other tool to watch XMLHttpRequests. 
   If you see them go out, in firebug, you can right click, copy the URL
   that OL is actually sending, and view it.
4. It's possible that you're having problems because your HTML is on
   a different host/port pair, but that doesn't seem likely given this
   example.

If you can't figure it out, the URL that OL is actually sending, and the
text that is coming back, would be nice. (Content can be an
attachement.) Also, you might want to do something like ?maxfeatures=10
to limit the length of these requests -- both in OL and elsewehre.
  
Regards,  
-- 
Christopher Schmidt
MetaCarta



More information about the Featureserver mailing list