Git Product home page Git Product logo

Comments (4)

isaacbrodsky avatar isaacbrodsky commented on May 9, 2024 1

GeoCoord here is an immutable object constructed by H3-Java so as to not tie it to different frameworks. It contains the latitude and longitude in degrees.

We don't currently have the options around GeoJson output formatting. H3-JS needs that option because it represents coordinates as either lat,lng or lng,lat. In Java these are typed fields, so there is no possibility of switching them. We could add support for formatting or parsing H3 geometries into GeoSpark/GeoJSON/WKT/etc. in a module alongside h3-java. I think this would be a separate set of functions so that only users needing that functionality pull in those dependencies.

Unfortunately I am not very familiar with GeoSpark, for your example, I'd suggest adding the conversion to GeoJSON directly to the UDF. E.g. convertToGeoJson(H3.instance.h3ToGeoBoundary(h3Index)) It looks like GeoSpark doesn't permit GeoCoords within Lists - this might be an issue of GeoCoord not implementing Serializable but I'm not 100% sure.

from h3-java.

JB-data avatar JB-data commented on May 9, 2024

Thanks for response!
Indeed, such a separate module would be a big plus. The current GeoCoord field comes from https://github.com/uber/h3-java/blob/master/src/main/java/com/uber/h3core/util/GeoCoord.java - for exporting to other geospatial tools it might have been more convenient to just write an array of (lat,long) tuples (without any strings)?

Thanks for the suggestion about the UDF. I believe you might be right about the serializable. I assume convertToGeo should be constructed then using some regular expressions after converting the result of h3ToGeoBoundary to a string, which indeed should be feasible.

Best&good luck with this project.

from h3-java.

isaacbrodsky avatar isaacbrodsky commented on May 9, 2024

You may still be able to avoid string serialization by mapping the GeoCoords into the form you need For example, you could do something like:

List<GeoCoord> coords = h3.h3ToGeoBoundary(index);
// convert to arrays of lat,lon
List<double[]> rawCoords = coords.stream().map(c -> new double[]{c.lat, c.lon}).collect(Collectors.toList());
return rawCoords;

from h3-java.

icemagno avatar icemagno commented on May 9, 2024

See #78

from h3-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.