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

KB article that shows how to import GeoJSON with a deeply nested object array. #2926

Merged

Conversation

linhgiang24
Copy link
Contributor

Summary

This KB article walks through an example of importing GeoJSON with a deeply nested object array.

Copy link
Member

@SpencerTorres SpencerTorres left a 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).
Copy link
Member

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.

Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is this site https://geojson.io that offers geoJSON rendering.
This is what the same dataset looks like:

Screenshot 2024-12-29 at 17 13 44

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

│ MultiPolygon │
└──────────────────────┘
```

Copy link
Member

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

Copy link
Contributor

@linhgiang24
Copy link
Contributor Author

@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.

@gingerwizard
Copy link
Contributor

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.

@allegrinisante
Copy link
Contributor

@gingerwizard, I've secured the geoJSON in my bucket. Let me know if you're okay with saving it on S3 under datasets-documentation, and I'll move forward.

@gingerwizard
Copy link
Contributor

@allegrinisante please yes move to the dataset-documentation bucket!

@allegrinisante
Copy link
Contributor

@allegrinisante please yes move to the dataset-documentation bucket!

The file is available here: s3://datasets-documentation/geoJSON/Municipios.geojson

@gingerwizard
Copy link
Contributor

@allegrinisante please yes move to the dataset-documentation bucket!

The file is available here: s3://datasets-documentation/geoJSON/Municipios.geojson

Can we use this in the docs @allegrinisante ? i've made public at

https://datasets-documentation.s3.eu-west-3.amazonaws.com/geoJSON/Municipios.geojson

@gingerwizard
Copy link
Contributor

Modified link, if this renders ok on build i'll merge. Follow up with enhancements @allegrinisante as discussed.

@gingerwizard
Copy link
Contributor

This needs to be rebased to build - the latest clickhouse repo docs are looking for a file which has been added after this PR was raised.

@gingerwizard gingerwizard merged commit a142b5c into main Jan 6, 2025
2 of 3 checks passed
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

Successfully merging this pull request may close these issues.

4 participants