[Featureserver] Unexpected Behavior When Posting Integer Attributes

Aaron Sutula Aaron.Sutula at noaa.gov
Fri Feb 15 13:09:02 EST 2008


I am trying to create a new feature in a postgis data source. This new 
feature contains an integer (as defined in my javascript and postgis db) 
attribute (user_id). When I post the feature to featureserver as:

{"type":"Feature","id":"OpenLayers.Feature.Vector_256","properties":{"name":"mex","tmp_key":"4fcbba363300efa935bf6ef28ac2ee12"

,"user_id":1},"geometry":{"type":"Point","coordinates":[-102.7783203125,26.298828125]},"crs":{"type"

:"OGC","properties":{"urn":"urn:ogc:def:crs:OGC:1.3:CRS84"}}}


I get the error:

An error occurred: int argument required

  File "/var/www/html/featureserver-1.11/FeatureServer/Server.py", line 281, in cgiHandler

    format, content = service.dispatchRequest( params, path_info, host, post_data, request_method, accepts

 )

  File "/var/www/html/featureserver-1.11/FeatureServer/Server.py", line 145, in dispatchRequest

    result = method(action)

  File "/var/www/html/featureserver-1.11/FeatureServer/DataSource/PostGIS.py", line 142, in create

    cursor.execute(str(sql), self.feature_values(feature))


If I cast user_id to a string, it works:

{"type":"Feature","id":"OpenLayers.Feature.Vector_277","properties":{"name":"mex","tmp_key":"4fcbba363300efa935bf6ef28ac2ee12"

,"user_id":"1"},"geometry":{"type":"Point","coordinates":[-101.3720703125,21.728515625]},"crs":{"type"

:"OGC","properties":{"urn":"urn:ogc:def:crs:OGC:1.3:CRS84"}}}


I can just be sure to cast all my integers to strings, but it just seems 
a little strange. Is there something about the JSON spec that I do not 
understand, or is this a featureserver issue? I should mention that I am 
using psycopg2.

Thanks,

Aaron Sutula



More information about the Featureserver mailing list