-
Notifications
You must be signed in to change notification settings - Fork 285
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
KB article that shows how to import GeoJSON with a deeply nested object array. #2926
base: main
Are you sure you want to change the base?
KB article that shows how to import GeoJSON with a deeply nested object array. #2926
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for writing this, glad to see more content related to Geo data. I've added a couple notes
How do I import GeoJSON with a nested object array? | ||
|
||
### Answer | ||
For this tutorial, we will use open data publicly available [here](https://opendata.esri.es/datasets/ComunidadSIG::municipios-ign/explore?location=39.536006%2C-0.303882%2C6.57). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this link expire or change? It looks very specific, perhaps we could recommend they go to a specific website rather than this exact location URL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This link comes from a real use case we discussed on the Community Slack channel. To ensure reproducibility and avoid relying on the URL, I recommend downloading the GeoJSON and making it available in our public bucket, similar to how we provide the New York Taxi Data
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
│ MultiPolygon │ | ||
└──────────────────────┘ | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to the count()
query, it may be good to demo something complex to show the analytical power of geo data in ClickHouse. Perhaps something that filters on one of the many columns? We also have some functions for measuring distance, but I don't think they can be easily applied to the polygon data
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll look into:
- https://clickhouse.com/docs/en/sql-reference/functions/geo/polygons#polygonareaspherical
- https://clickhouse.com/docs/en/sql-reference/functions/geo/polygons#polygonperimeterspherical
- https://clickhouse.com/docs/en/sql-reference/functions/geo/polygons#polygonareacartesian
- https://clickhouse.com/docs/en/sql-reference/functions/geo/polygons#polygonperimetercartesian
@SpencerTorres One of the questions we have is whether this KB is still relevant since we have the JSON data type now. @allegrinisante is the author of the KB and is looking to review and possibly adapt it to the new capabilities. But was just wondering what your thoughts are. |
Explicitly mapping structures with tuples and nested still has its place - mainly for performance. JSON is for dynamic data. Can we address the first comment of @SpencerTorres @linhgiang24 re the link. this is the only blocker to merging. Comment 2 re better example query is not a blocker but a nice to have. |
@gingerwizard, I've secured the geoJSON in my bucket. Let me know if you're okay with saving it on S3 under |
@allegrinisante please yes move to the dataset-documentation bucket! |
The file is available here: s3://datasets-documentation/geoJSON/Municipios.geojson |
Summary
This KB article walks through an example of importing GeoJSON with a deeply nested object array.