[Featureserver] Problem with PostGIS

Josh Livni mailing_lists at umbrellaconsulting.com
Thu Feb 7 12:49:46 EST 2008


Paolo,

Thanks for the details.  I don't know about the ogr issue, but I did 
notice an issue in the trunk that would cause the postgis issue you 
mentioned.  I've commited a fix - please update from svn and let us know 
if you still have this error with the postgis layer.

  -Josh



Paolo Corti wrote:
> Now I have installed featureserver from svn
>
> The demo is working perfectly
>
> I have 2 problems with my dataset:
>
> 1) with shapefile I can correctly query it, but I get in problems if I
> try to update it, like:
>
> #test shape
> [zone]
> type=OGR
> dsn=/home/corti/temp/testfeatureserver/zone.shp
> layer=zone
>
>  curl -X DELETE http://featureserver/featureserver.cgi/zone/1.json
> An error occurred: Delete error on FID 1: Unknown failure
>   File "/home/corti/public_html/featureserversvn/trunk/featureserver/FeatureServer/Server.py",
> line 296, in cgiHandler
>     format, content = service.dispatchRequest( params, path_info,
> host, post_data, request_method, accepts )
>   File "/home/corti/public_html/featureserversvn/trunk/featureserver/FeatureServer/Server.py",
> line 145, in dispatchRequest
>     result = method(action)
>   File "/home/corti/public_html/featureserversvn/trunk/featureserver/FeatureServer/DataSource/OGR.py",
> line 89, in delete
>     % (action.id, self.error_msgs[err]))
>
> 2) with PostGIS it seems I get in this not understandable issue -
> every query gives the same message:
>
> #test postgis
> [zone2]
> type=PostGIS
> dsn=host=localhost dbname=gisdb user=gis password=gis
> layer=zone2
> fid=gid
> geometry=the_geom
> #attribute_cols=name,some_interesting_column #optional
> #order=cost #optional
>
> http://featureserver/featureserver.cgi/zone2/all.gml
>
> An error occurred: local variable 'props' referenced before assignment
>   File "/home/corti/public_html/featureserversvn/trunk/featureserver/FeatureServer/Server.py",
> line 296, in cgiHandler
>     format, content = service.dispatchRequest( params, path_info,
> host, post_data, request_method, accepts )
>   File "/home/corti/public_html/featureserversvn/trunk/featureserver/FeatureServer/Server.py",
> line 145, in dispatchRequest
>     result = method(action)
>   File "/home/corti/public_html/featureserversvn/trunk/featureserver/FeatureServer/DataSource/PostGIS.py",
> line 211, in select
>     if not props['fs_text_geom']: continue
>
> Let me know
>
> BTW: should I keep writing you or should I post the messages to the list?
> Is there a way to search the list except then with google?
> http://featureserver.org/pipermail/featureserver/
>
> thanks again
> Paolo
>
> On Feb 7, 2008 5:14 PM, Paolo Corti <pcorti at gmail.com> wrote:
>   
>> Thanks!
>>
>> I wasn't using featureserver from svn, so the PostGIS sample was
>> without user and password (and from the python script I could not
>> figure out how to connect with a different user than www-data).
>> Anyway also with other queries I get the same error.
>>
>> http://featureserver/featureserver.cgi/zone2/all.json?maxfeatures=5
>>
>> An error occurred: ERROR:  current transaction is aborted, commands
>> ignored until end of transaction block
>>
>> SELECT AsText(the_geom) as fs_text_geom, * FROM "zone2" LIMIT 5
>>   File "/home/corti/public_html/featureserver/FeatureServer/Server.py",
>> line 281, in cgiHandler
>>     format, content = service.dispatchRequest( params, path_info,
>> host, post_data, request_method, accepts )
>>   File "/home/corti/public_html/featureserver/FeatureServer/Server.py",
>> line 145, in dispatchRequest
>>     result = method(action)
>>   File "/home/corti/public_html/featureserver/FeatureServer/DataSource/PostGIS.py",
>> line 201, in select
>>     cursor.execute(str(sql), attrs)
>>
>> Now I am going to try with featureserver from svn, maybe that will
>> solve this issue.
>>
>> thanks
>> Paolo
>>
>>
>> On Feb 7, 2008 4:39 PM, Josh Livni <josh at umbrellaconsulting.com> wrote:
>>     
>>> Paolo,
>>>
>>> You can have featureserver connect  to the database with any user - just
>>> change the dsn line.  The postgis example in the docs shows you an
>>> example of this.
>>>
>>> That said, I'm not sure what's causing this error.  Can you try another
>>> type of query, such as
>>>
>>> /featureserver.cgi/zone2/all.json?maxfeatures=5
>>>
>>>   -Josh
>>>
>>>
>>>
>>> Paolo Corti wrote:
>>>       
>>>> Hi!
>>>>
>>>> I am totally new to featureserver, but since what I am seeing looks an
>>>> amazing project.
>>>> I like the REST-Pythonic architecture
>>>>
>>>> I have successfully installed it, and I can use the demo, query the
>>>> layers, and and edit features.
>>>>
>>>> Now I am trying to use some personal dataset, to test it more deeply.
>>>> I could add shapefiles with no troubles, the issues came when I tried
>>>> to add PostGIS layers.
>>>>
>>>> first I have added this layer to featureserver.cfg:
>>>>
>>>> [zone2]
>>>> type=PostGIS
>>>> dsn=dbname=gisdb
>>>> layer=zone2
>>>> fid=gid
>>>> geometry=the_geom
>>>>
>>>> first I had problems with accessing the database, I had to create a
>>>> www-data role (looks from sources that there is no way to use a
>>>> specific postgres user in the featureserver.cfg, so featureserver is
>>>> accessing postgis as the www-data user - I am using Apache CGI).
>>>>
>>>> After adding the www-data role, I had this new error:
>>>>
>>>> http://featureserver/featureserver.cgi/zone2/1.gml
>>>>
>>>> I get:
>>>>
>>>> An error occurred: ERROR:  current transaction is aborted, commands
>>>> ignored until end of transaction block
>>>>
>>>> SELECT AsText(the_geom) as fs_text_geom, * FROM "zone2" WHERE gid = 1
>>>>   File "/home/corti/public_html/featureserver/FeatureServer/Server.py",
>>>> line 281, in cgiHandler
>>>>     format, content = service.dispatchRequest( params, path_info,
>>>> host, post_data, request_method, accepts )
>>>>   File "/home/corti/public_html/featureserver/FeatureServer/Server.py",
>>>> line 145, in dispatchRequest
>>>>     result = method(action)
>>>>   File "/home/corti/public_html/featureserver/FeatureServer/DataSource/PostGIS.py",
>>>> line 172, in select
>>>>     cursor.execute(str(sql), {self.fid_col: action.id})
>>>>
>>>> If I query PostGIS wit the SELECT is causing the error, I correctly
>>>> get the feature (with gid=1).
>>>>
>>>> Could you give me some help?
>>>>
>>>> thanks, and again congrats for the wonderfull project!
>>>>
>>>> Paolo
>>>>
>>>>
>>>>
>>>>
>>>>         
>>
>>
>> --
>> Paolo Corti
>> http://www.paolocorti.net
>>
>>     
>
>
>
>   



More information about the Featureserver mailing list