Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spatial radius query not working #54

Open
bertday opened this issue Apr 20, 2017 · 2 comments
Open

Spatial radius query not working #54

bertday opened this issue Apr 20, 2017 · 2 comments

Comments

@bertday
Copy link

bertday commented Apr 20, 2017

I was previously using a query like this to fetch rows from Socrata based on a spatial radius search (500 feet or 152.4 meters).

https://data.phila.gov/resource/4t9v-rppq.json?%24where=within_circle(shape%2C+39.94999294102174%2C+-75.15972321506867%2C+152.4)&%24select=requested_datetime%2C+address%2C+service_name%2C+shape%2C+DISTANCE_IN_METERS(shape%2C+%27POINT(-75.15972321506867+39.94999294102174)%27)+*+3.28084AS+distance&%24order=DISTANCE_IN_METERS(shape%2C+%27POINT(-75.15972321506867+39.94999294102174)%27)+*+3.28084

That now gives an error: column \"shape\" does not exist

Per a suggestion by @awm33 I tried replacing the field name shape with location, which appears to be the soda-carto default for spatial columns.

https://data.phila.gov/resource/4t9v-rppq.json?%24where=within_circle(location%2C+39.94999294102174%2C+-75.15972321506867%2C+152.4)&%24select=requested_datetime%2C+address%2C+service_name%2C+location%2C+DISTANCE_IN_METERS(location%2C+%27POINT(-75.15972321506867+39.94999294102174)%27)+*+3.28084AS+distance&%24order=DISTANCE_IN_METERS(location%2C+%27POINT(-75.15972321506867+39.94999294102174)%27)+*+3.28084

I'm now getting an error column \"location\" does not exist.

@andrewbt , I was told you might have some insights into how this works. Would appreciate any tips, thanks!

@timwis
Copy link
Contributor

timwis commented Apr 25, 2017

Hey @rbrtmrtn, check out the response headers to see what soda-carto translates the query to and sends to carto. It's not quite the diagnosis you gave, but I think this dataset has bigger problems: there's no the_geom field! I wonder how that could happen? Copying in @VitoWSalerno - he and @phaedratinder-phila were just working on this one in slack.

EDIT: Also, @rbrtmrtn, distance_in_meters support hasn't been implemented yet but should be pretty easy to do (example).

@VitoWSalerno
Copy link

@timwis @rbrtmrtn This dataset is currently having the same issue as the opa assessment history dataset is having. (the dataset is disappearing from the dashboard and the_geom is being replaced with invalid_the_geom). @awm33 is looking into alternate ways to load the data that hopefully will not have this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants