locana-co / PGRestAPI

Node.js REST API for PostGres Spatial Entities. AKA: SpatialServer
Apache License 2.0
436 stars 75 forks source link

PostGIS table endpoint should be JSON, not GeoJSON? #105

Open stevage opened 9 years ago

stevage commented 9 years ago

Currently the endpoint to query the columns available for a PostGIS table is set to GeoJSON:

http://.../services/tables/mytable&format=json?format=geojson

And sure enough, a file is generated with the extension '.geojson'.

But it's not a GeoJSON file, and it doesn't make sense for it to be, since it contains no geometry, just metadata.

Removing the ?format=geojson doesn't work though, you get an error "Table does not exist or has no columns".

apollolm commented 9 years ago

Thanks for reporting this. You're right - I started by making everything geojson, even if it doesn't have geo stuff in it. I'll work on tightening this up. You should be able to replace the format=geojson with format=json (which I see you did above in your sample) and get just a plain ol' .json file.

However, in your sample above, you specified both json and geojson (and you have an ampersand where it shouldn't be) :

http://.../services/tables/mytable&format=json?format=geojson

If you only specify json, you should get the file you desire:

http://.../services/tables/mytable?format=json

This works for me on the dev and master branches.

I need to update the UI table endpoint to show the examples using .json instead of .geojson.

stevage commented 9 years ago

Doh. Sorry for being dumb. :-)

On Thu, 19 Mar 2015 3:30 pm Ryan Whitley notifications@github.com wrote:

Thanks for reporting this. You're right - I started by making everything geojson, even if it doesn't have geo stuff in it. I'll work on tightening this up. You should be able to replace the format=geojson with format=json (which I see you did above in your sample) and get just a plain ol' .json file.

However, in your sample above, you specified both json and geojson:

http://.../services/tables/mytable&format=json?format=geojson

If you only specify json, you should get the file you desire:

http://.../services/tables/mytable&format=json

This works for me on the dev and master branches.

I need to update the UI table endpoint to show the examples using .json instead of .geojson.

— Reply to this email directly or view it on GitHub https://github.com/spatialdev/PGRestAPI/issues/105#issuecomment-83315008 .