-
Notifications
You must be signed in to change notification settings - Fork 472
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
h3 index converted to Geocoordinates: how to export to geojson #369
Comments
It seems like these questions might be specific to the h3-java binding - it might make more sense to repost them there? For the core library, we've chosen for now not to deal with specific output formats, as there are many and it's not clear where the boundaries of the core lib would be if we took this on (e.g. does it write GeoJSON strings, or just produce a GeoJSON-like data structure? Do we handle SHP files, KML, etc?). The actual output formats that would be most useful vary by language, so we've generally left this to the bindings to handle. |
THanks so much for fast response. |
Maybe can you say something though about the used coordinates: is GeoCoord the google data type like this one here: |
We're not using the Google class - |
OK, it seems to me that this makes it a bit hard to export the results to other geospatial tools which is a bit of a pitty for such a useful library. (lat,lon) tuples might have been easier for this purpose. |
Closing, reposted as uber/h3-java#66 |
Hi,
I had 2 quesions related to using h3ToGeoBoundary:
Question 1:
I am doing some preprocessing in spark using h3, and I want to save my results into a format that can easily be exported. My goal is to load the data in geomesa/geoserver. I notice that using h3ToGeoBoundary I get results that are a list of GeoCoord like this:
[GeoCoord{lat=50.346809, lng=14.153511}, GeoCoord{lat=50.316251, lng=14.138129}, GeoCoord{lat=50.294416, lng=14.173950}, GeoCoord{lat=50.303130, lng=14.225160}, GeoCoord{lat=50.333686, lng=14.240581}, GeoCoord{lat=50.355530, lng=14.204753}]
I assume this is the google coordinate type: https://pub.dev/documentation/google_directions_api/latest/google_directions_api/GeoCoord-class.html.
But is this compatible with geospark/geomesa?
It would be very helpful, if there was an option to save this as let's say geojson like there is for h3-js (https://github.com/uber/h3-js#module_h3.h3ToGeoBoundary where a boolean decides how it is saved).
Is there an example somewhere, if I have let's say 10k h3 indexes how to save it into a format that other geospatial tools (geomesa or geospark ) can read?
Question2:
Also when I want to apply a udf to a full column with h3 indexes, this works:
//works
val h3ToGeoBoundary = udf{ (h3Index: Long) =>
H3.instance.h3ToGeoBoundary(h3Index).toString()
}
but this does not:
//does not work
val h3ToGeoBoundaryGeoJson = udf{ (h3Index: Long) =>
H3.instance.h3ToGeoBoundary(h3Index)
}
//error:java.lang.UnsupportedOperationException: Schema for type java.util.List[com.uber.h3core.util.GeoCoord] is not supported
This means that if I want to create a dataframe with couple 1000 rows, I can only have that in string format, which does not allow me to do transformations on it (like selecting each element of the list, and using those coordinates to turn it myself into geojson).
Any clue how to solve this?
Thanks!
PS: great job-very user friendly and cool library.
The text was updated successfully, but these errors were encountered: