[Featureserver] postgis connection

Christopher Schmidt crschmidt at metacarta.com
Fri Oct 19 15:06:59 EDT 2007


On Fri, Oct 19, 2007 at 02:53:42PM -0400, Bobby Braswell wrote:
> 
> Hi-
> 
> I am trying to set up a postGIS backend to featureserver. I was  
> previously using the DBM option, and this worked for me (it's  
> awesome, by the way, thanks) with no problems. With postgis I am  
> missing something, perhaps obvious, but I'm sorry that I couldn't  
> find the answer in the archives or docs.
> 
> My config file looks like the example in the documentation:
> 
> [metadata]
> default_service=GeoJSON
> 
> [scribble]
> type=PostGIS
> dsn=dbname=mydata
> layer=mylayer
> fid=ogc_fid
> geometry=wkb_geometry
> 
> I believe I have settled access and permissions issues, and I have a  
> postGIS database called mydata, with a table called mylayer, defined  
> as follows:
> 
> CREATE TABLE mylayer (ogc_fid INTEGER, wkb_geometry GEOMETRY;
> GRANT ALL ON TABLE mylayer TO www;
> 
> The database was built using a postgis template and has the usual  
> geometry_columns and spatial_ref_sys tables.
> 
> However I get the following error from the browser:
> Error: invalid label
> Source File: https://portsmouthresponse.unh.edu/cgi/featureserver.cgi/ 
> scribble/all.json?maxfeatures=20&callback=load_list
> Line: 1, Column: 11
> Source Code:
> {"features": []}

""" 
* adding 'gaping_security_hole=yes' to any datasource will allow it to
   be loaded via JSON callbacks. You should only enable this option if
   the data you are serving should have unlimited distribution. Enabling
   this option can allow users to obtain data from your server *even if you
   are behind a firewall*. Again, you should only enable this option if the
   data you are working with has *unlimited distribution*.

   Once you do this, simply specify 'callback=' as a parameter, and the
   JSON data will be wrapped inside the following:

     callback_value({'data':'here'})
"" -- doc/Services.txt


> This line is what I get if I issue the create command using curl. I'm  
> not sure what "invalid layer" is referring to.
> One question is: should I indeed be creating the table myself? In the  
> DBM case, featureserver created the database in /tmp.

Yes, you need to create teh table yourself.

> Also: I feel like the table should have more columns corresponding to  
> the attributes of the geometric objects I am uploading, for some  
> reason I'm not clear on how many those are or where they are coming  
> from. 

They come from the table that you are loading against -- any columns
which are not the id or geometry are turned into attributes.

> I hope I have provided a clear explanation of my problem and  
> that it is not
   .... cut off mid-sentence? :)

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Featureserver mailing list