Coder Social home page Coder Social logo

How to convert projection about geozero HOT 5 CLOSED

georust avatar georust commented on September 6, 2024
How to convert projection

from geozero.

Comments (5)

frewsxcv avatar frewsxcv commented on September 6, 2024 1

There's now a Transform trait in the proj crate (and also reexported in the geo crate) that you can use that will make this a little simpler https://docs.rs/proj/latest/proj/trait.Transform.html

from geozero.

michaelkirk avatar michaelkirk commented on September 6, 2024

geozero is principally concerned with reading and writing different formats of geospatial data, but it doesn't really have any facilities for transforming the data.

Or would I need to use it in combination with https://github.com/georust/proj

That should work! The specifics will depend on what your input and output are exactly.

proj crate knows how to work with geo-types geometries, so my approach would probably be something like:

  1. use geozero's geo-types reader, depending on your particular format (see the proj README for examples)
  2. use the to_geo method to get geo-types geometries
  3. use the proj crate to project the geo-types geometries to whatever SRS you want
  4. use geozero to write back to whatever supported format you'd like

from geozero.

michaelkirk avatar michaelkirk commented on September 6, 2024

I don't think there's anything left to do here, so closing.

from geozero.

michaelkirk avatar michaelkirk commented on September 6, 2024

@musicformellons - I actually ended up trying to do something like what you mentioned and had a hard time. 😅

I was able to go from geojson -> geo_types -> proj -> geojson easy enough.

But the complication I encountered was that I didn't see a non-terrible way to maintain the geojson's properties (since they are lost at the "-> geo_types" step.

Did you end up getting something like this to work?

from geozero.

musicformellons avatar musicformellons commented on September 6, 2024

@michaelkirk I think in the end I might not needed it. I see only 'proj' and 'geo-types' in my cargo.toml. I was working with shapefiles. So can't help I'm afraid.

from geozero.

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.