[Featureserver] Fwd: postgis connection

Bobby Braswell rob.braswell at unh.edu
Fri Oct 19 18:26:24 EDT 2007


alas, this only works with points, not lines or polygons.  
OpenLayers-2.5 (see https://portsmouthresponse.unh.edu/testmap.html)  
generates the following:

{"type":"FeatureCollection","features": 
[{"type":"Feature","id":"OpenLayers.Feature.Vector_393","properties": 
{},"geometry":{"type":"Point","coordinates": 
[-70.77940063476562,43.425469970703126]}}],"crs": 
{"type":"OGC","properties":{"urn":"urn:ogc:def:crs:OGC:1.3:CRS84"}}}

which is for a point, and which loads into postgis. For a line, you get:

{"type":"FeatureCollection","features": 
[{"type":"Feature","id":"OpenLayers.Feature.Vector_499","properties": 
{},"geometry":{"type":"LineString","coordinates": 
[[-70.37565307617187,43.554559326171876], 
[-70.87827758789062,43.535333251953126]]}}],"crs": 
{"type":"OGC","properties":{"urn":"urn:ogc:def:crs:OGC:1.3:CRS84"}}}

which is not saved. Is this the GeoJSON issue?

Sorry, I thought I was going to be out of your hair.

Best,
Rob Braswell


On Oct 19, 2007, at 4:48 PM, Christopher Schmidt wrote:

> On Fri, Oct 19, 2007 at 04:37:41PM -0400, Bobby Braswell wrote:
>>
>> Thanks very much for the quick reply. I changed my table definition
>> to the following:
>>
>> createdb -U postgres mydata -T template_postgis
>> psql -U postgres -d mydata
>> # CREATE TABLE mylayer (ogc_fid SERIAL NOT NULL, CONSTRAINT
>> mylayer_ogc_fid
>> # PRIMARY KEY (ogc_fid));
>> # GRANT ALL ON TABLE mylayer TO www;
>> # GRANT ALL ON mylayer_ogc_fid_seq TO www;
>> # SELECT AddGeometryColumn 
>> ('','mylayer','wkb_geometry','4326','POINT',
>> 2);
>>
>> Now I can successfully do the following manual upload:
>>
>>  % echo '{"id":1, "geometry":{"type":"Point", "coordinates":
>> [-70,43]}}' | curl -k -d @- https://portsmouthresponse.unh.edu/cgi/
>> featureserver.cgi/scribble/
>> {"crs": {"type": "none", "properties": {"info": "No CRS information
>> has been provided with this data."}}, "type": "FeatureCollection",
>> "features": [{"geometry": {"type": "Point", "coordinates": [0.0,
>> 5.0]}, "type": "Feature", "id": 1, "properties": {}}]}
>>
>> And the point appears on my test OpenLayers map: https://
>> portsmouthresponse.unh.edu/testmap.html
>>
>> which is great. However, I can't add a new feature from the map, as I
>> had done before with the DBM database, via a simple 'post' of:
>>
>> {"type":"FeatureCollection","features":
>> [{"type":"Feature","id":"OpenLayers.Feature.Vector_289","properties":
>> {},"geometry":{"type":"Point","coordinates":
>> [-70.87003784179687,43.2922607421875]}}],"crs":
>> {"type":"OGC","properties":{"urn":"urn:ogc:def:crs:OGC:1.3:CRS84"}}}
>> Features: 134
>>
>> Here is where I think I'm getting into the "new GeoJSON" issue.
>>
>> I tried removing the "default_service" line from my config file with
>> no effect.
>
> With OpenLayers 2.5, you'll need default_service=GeoJSON. Playing with
> your FS, I was able to draw a point, then serialize the GeoJSON, and
> dump it with curl to
> https://portsmouthresponse.unh.edu/cgi/featureserver.cgi/ 
> scribble.geojson,
> which worked. I think that means you just need to bring your
> default_service= back.
>
> Regards,
> -- 
> Christopher Schmidt
> MetaCarta




More information about the Featureserver mailing list