[Featureserver] Fwd: postgis connection

Christopher Schmidt crschmidt at metacarta.com
Fri Oct 19 15:27:50 EDT 2007


On Fri, Oct 19, 2007 at 03:19:46PM -0400, Bobby Braswell wrote:
> 
> Hi-
> 
> Update on my previous question, sorry for not including this piece of  
> information. This is the error I get when I try to manually upload a  
> point to my postgis featureserver instance:
> 
> % echo '{"id":1, "geometry":{"type":"Point", "coordinates":[[0,5]]}}'  
> | curl -k -d @- https://portsmouthresponse.unh.edu/cgi/ 
> featureserver.cgi/scribble/
> An error occurred: float argument required
>   File "/sw/lib/python2.5/site-packages/FeatureServer/Server.py",  
> line 273, in cgiHandler
>     format, content = service.dispatchRequest( params, path_info,  
> host, post_data, request_method, accepts )
>   File "/sw/lib/python2.5/site-packages/FeatureServer/Server.py",  
> line 137, in dispatchRequest
>     result = method(action)
>   File "/sw/lib/python2.5/site-packages/FeatureServer/DataSource/ 
> PostGIS.py", line 113, in create
>     values = ", ".join(self.value_formats(feature)+["SetSRID('% 
> s'::geometry, %s) " % (self.to_wkt(feature.geometry), self.srid)])
>   File "/sw/lib/python2.5/site-packages/FeatureServer/DataSource/ 
> PostGIS.py", line 70, in to_wkt
>     return "POINT(%s)" % coords_to_wkt(coords)
>   File "/sw/lib/python2.5/site-packages/FeatureServer/DataSource/ 
> PostGIS.py", line 67, in coords_to_wkt
>     return ",".join(["%f %f" % tuple(c) for c in coords])
> 
> In particular, I'm not sure what the "float argument required"  
> message means.

I'm assuming you've updated your code to a newer FeatureServer. If so,
you'll see there is a default_service=GeoJSON -- this sets the default
service to be *real* GeoJSON, as opposed to the hacked up version that
FeatureServer has always used. This is the default since OpenLayers 2.5 is
now using real GeoJSON -- but it means that the above is not valid. It
should be:

% echo '{"id":1, "geometry":{"type":"Point", "coordinates":[0,5]}}' 

That is -- the point coordinates changed format. 

Alternatively, if your app uses the old GeoJSON, you can drop back by
killing the default_service= line from your FS config, or changing it to
"JSON", since at some point in the future GeoJSON will likely become the
default.

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Featureserver mailing list