[Featureserver] curl usage issue

Yves Moisan yves.moisan at boreal-is.com
Thu Dec 4 13:44:18 EST 2008


> Please go ahead and try use the svn trunk instead (r580).  

OK.  On r580  :

> If that doesn't work, reply including the relevant layer of your
> featureserver.cfg, 

[PGTEST]
type=PostGIS
dsn=host=localhost port=5433 dbname=pd_tfm_data user=bla password=bla
layer=geo_survey_gps_pt
fid=gid
geometry=the_geom
srid=4326
attribute_cols=comment
# order=cost
gaping_security_hole=yes

I'm running FS on WSGI : 
python featureserver_http_server.py

The json file I'm shoving in  :

{"features": [{"geometry": {"type": "Point", "coordinates":
[[411869.733939, 8831369.48172]]}, "id": 99999, "properties":
{"comment": "99999"}}]}

error : 

C:\temp>curl -d @fs-test.json
http://my.server:8080/PGTEST/create.geojson
An error occurred: float argument required
  File "C:\featureserver-trunk\featureserver\web_request\handlers.py",
line 144, in wsgi
    accepts = accepts )
  File "C:\featureserver-trunk\featureserver\FeatureServer\Server.py",
line 161, in dispatchRequest
    result = method(action)
  File "C:\featureserver-trunk\featureserver\FeatureServer\DataSource
\PostGIS.py", line 111, in create
    values = ", ".join(self.value_formats(feature)+["SetSRID('%
s'::geometry, %s) " % (WKT.to_wkt(feature.geometry), self
.srid)])
  File "C:\featureserver-trunk\featureserver\vectorformats\Formats
\WKT.py", line 68, in to_wkt
    return "POINT(%s)" % coords_to_wkt((coords,))
  File "C:\featureserver-trunk\featureserver\vectorformats\Formats
\WKT.py", line 64, in coords_to_wkt
    return ",".join([format_str % tuple(c) for c in coords])

Probable explanations : SRID 4326 isn't what my table has.  In fact, we
have the bad habit of not putting a SRID, so I forgot what the EPSG code
is in the PostGIS table.  I tried also with lat lon coordinate values in
my json file and it did not work.

Cheers,

Yves

> and the latest traceback
> 
> cheers,
> 
>   -josh
> 
> On Thu, Dec 4, 2008 at 9:09 AM, Yves Moisan
> <yves.moisan at boreal-is.com> wrote:
>         Hi Josh,
>         
>         > Hi Yves,
>         >
>         >
>         > Your geojson upload to featureserver does indeed include the
>         geometry
>         > twice:  Both described as 'Point' and in your the_geom
>         column.
>         
>         
>         Right
>         
>         > So you don't want to include the_geom in your upload -
>         remove it from
>         > your geojson and it should work.
>         
>         
>         Indeed I tried that before I posted to the list.  I'm using FS
>         1.12 but
>         at any rate I removed the_geom from my file and called with
>         create.geojson this time :
>         
>         C:\temp>curl -d @fs-test.json
>         
>         http://my.server.com:8084/PGTEST/create.geojson
>         An error occurred: float argument required
>          File "C:\featureserver-1.12\FeatureServer\Server.py", line
>         242, in
>         wsgiHandler
>            format, content = service.dispatchRequest( params,
>         path_info, host,
>         post_data, request_method, accepts )
>          File "C:\featureserver-1.12\FeatureServer\Server.py", line
>         145, in
>         dispatchRequest
>            result = method(action)
>          File "C:\featureserver-1.12\FeatureServer\DataSource
>         \PostGIS.py", line
>         
>         138, in create
>            values = ", ".join(self.value_formats(feature)+["SetSRID('%
>         s'::geometry, %s) " % (self.to_wkt(feature.geometry), sel
>         f.srid)])
>          File "C:\featureserver-1.12\FeatureServer\DataSource
>         \PostGIS.py", line
>         
>         90, in to_wkt
>            return "POINT(%s)" % coords_to_wkt(coords)
>          File "C:\featureserver-1.12\FeatureServer\DataSource
>         \PostGIS.py", line
>         
>         87, in coords_to_wkt
>            return ",".join(["%f %f" % tuple(c) for c in coords])
>         
>         I don't see what float argument is missing.  Do I need to
>         specify the
>         SRID ?
>         
>         Cheers,
>         
>         Yves
>         
>         
>         >
>         >
>         >
>         > In general, featureserver shouldn't return your the_geom
>         column in the
>         > first place, but that's another story (an OT side note:  the
>         FS docs
>         > should explain, in the postgis section, how to have it
>         return only a
>         > subset of columns if you want -- although again, it
>         shouldn't be
>         > returning your the_geom column column at all assuming it's
>         the only
>         > geometry column on the table  )
>         >
>         >
>         >   -Josh
>         >
>         > On Thu, Dec 4, 2008 at 8:48 AM, Yves Moisan
>         > <yves.moisan at boreal-is.com> wrote:
>         >         Hi All,
>         >
>         >         I'm trying to upload a .json file
>         >
>         >         {"features": [{"geometry": {"type": "Point",
>         "coordinates":
>         >         [[411869.733939, 8831369.48172]]}, "id": 99999,
>         "properties":
>         >         {"comment": "99999", "the_geom":
>         >
>         "0101000080BCD28DEF5A23194199456ACF30D86041A78B461654CB9540"}}]}
>         >
>         >         C:\temp>curl -d @fs-test.json
>         >          http://my.machine:8084/PGTEST/create.json
>         >         An error occurred: column "the_geom" specified more
>         than once
>         >         LINE 1: ...SERT INTO "geo_survey_gps_pt" (comment,
>         the_geom,
>         >         the_geom) ...
>         >
>         ^
>         >
>         >          File "C:\featureserver-1.12\FeatureServer
>         \Server.py", line
>         >         242, in
>         >         wsgiHandler
>         >            format, content =
>         service.dispatchRequest( params,
>         >         path_info, host,
>         >         post_data, request_method, accepts )
>         >          File "C:\featureserver-1.12\FeatureServer
>         \Server.py", line
>         >         145, in
>         >         dispatchRequest
>         >            result = method(action)
>         >          File "C:\featureserver-1.12\FeatureServer
>         \DataSource
>         >         \PostGIS.py", line
>         >         142, in create
>         >            cursor.execute(str(sql),
>         self.feature_values(feature))
>         >
>         >         If I erase the "the_geom" property from my file :
>         >
>         >         {"features": [{"geometry": {"type": "Point",
>         "coordinates":
>         >         [[411869.733939, 8831369.48172]]}, "id": 99999,
>         "properties":
>         >         {"comment": "99999"}}]}
>         >
>         >         I get :
>         >
>         >         C:\temp>curl -d @fs-test.json
>         >          http://my.machine:8084/PGTEST/create.json
>         >         An error occurred: new row for relation
>         "geo_survey_gps_pt"
>         >         violates
>         >         check constraint "enforce_srid_the_geom"
>         >
>         >          File "C:\featureserver-1.12\FeatureServer
>         \Server.py", line
>         >         242, in
>         >         wsgiHandler
>         >            format, content =
>         service.dispatchRequest( params,
>         >         path_info, host,
>         >         post_data, request_method, accepts )
>         >          File "C:\featureserver-1.12\FeatureServer
>         \Server.py", line
>         >         145, in
>         >         dispatchRequest
>         >            result = method(action)
>         >          File "C:\featureserver-1.12\FeatureServer
>         \DataSource
>         >         \PostGIS.py", line
>         >         142, in create
>         >            cursor.execute(str(sql),
>         self.feature_values(feature))
>         >
>         >         because there is indeed a constraint in the table.
>         >
>         >         Pointers appreciated.
>         >
>         >         TIA,
>         >
>         >         Yves Moisan
>         >
>         >
>         >         _______________________________________________
>         >         Featureserver mailing list
>         >         Featureserver at openlayers.org
>         >
>         http://featureserver.org/mailman/listinfo/featureserver
>         >
>         >
>         
>         
> 




More information about the Featureserver mailing list