-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
Repeat Parks results #57
Comments
I can imagine 2 strategies: A) data cleanup on the database layer: aggregate all "duplicate" records to multi-part geometries In case of B you'll need to do an aggregation on the park detail view then too, to show all geometries of the park. |
Thank you, @cspanring. I like strategy A. It looks like the parks_park geometry field is already a MultiPolygon type. Quickly pulling it in QGIS, I can dissolve on the name field. That way there aren't "duplicates". Dissolving or grouping by a string is not my favorite way of doing this, but I don't see another field to use for this operation. Presumably, if I write a query that does this, it'll have to update the foreign keys in other tables. Thanks for any help you're able to provide! |
I think I will have to create a join key for matching old IDs to aggregated IDs. Then somehow update the foreign-key constraints and references. Here's the \d+ output:
I don't think it's possible to update a table with group by, then update referencing tables. |
Ah, theres a m:m between parks and neighborhoods. That join table will have to be updated especially. |
Same with park_images. At first, I wasn't sure why, but many images are related to many "parks" which are split into separate geometries. Similarly, this join table would need to be update. @cspanring I remember you mentioned that serializing GeoJSON was the reason for using only singlepart geometries. I'm not sure where in the app we needed to serialize GeoJSON - the map data itself is a static topo.json.
|
I think the initial version used GeoJSON. The park detail view also uses GeoJSON on the map I believe. |
Works nicely, but excludes 5 geometries that are invalid. Running something like I'm repairing the geometries in ArcGIS instead and will move forward after that! |
There are a number of data migrations required if we use strategy A. Strategy B, #distinct on 'name' works perfectly. This will break the existing map, but that can be fixed. |
When filtering parks in the API:
http://0.0.0.0:8000/parks/search?neighborhoods=15
The database returns, for example, Mystic River Reservation multiple times. The actual database table has these repeated entries, and they have unique ids, but I'm not sure why they are repeated and I don't want it to break the map.
So, how do we eliminate duplicate results and not break the map?
The text was updated successfully, but these errors were encountered: