Coder Social home page Coder Social logo

Comments (5)

snowman2 avatar snowman2 commented on June 16, 2024 1

It appears there are multiple transformations to choose from now:

>>> from pyproj import CRS, Transformer
>>> transformer = Transformer.from_crs(CRS(27700).to_3d(), CRS(4978).to_3d())
>>> transformer.to_proj4()
>>> transformer
<Unknown Transformer: unknown>
Description: unavailable until proj_trans is called
Area of Use:
- undefined
>>> from pyproj.transformer import TransformerGroup
>>> group = TransformerGroup(CRS(27700).to_3d(), CRS(4978).to_3d())
>>> group
<TransformerGroup: best_available=True>
- transformers: 9
- unavailable_operations: 0
>>> group.transformers[0].to_proj4()
'+proj=pipeline +step +inv +proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +step +proj=hgridshift +grids=uk_os_OSTN15_NTv2_OSGBtoETRS.tif +step +proj=cart +ellps=WGS84'
>>> group.transformers[1].to_proj4()
'+proj=pipeline +step +inv +proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +step +proj=cart +ellps=airy +step +proj=helmert +x=446.448 +y=-125.157 +z=542.06 +rx=0.15 +ry=0.247 +rz=0.842 +s=-20.489 +convention=position_vector'

from pyproj.

romaintha avatar romaintha commented on June 16, 2024

Yet I find it confusing :

>>> from pyproj import CRS, Transformer
>>> transformer = Transformer.from_crs(CRS(27700).to_3d(), CRS(4978).to_3d())
>>> transform.transform(530695.017566992, 180664.24589561723, 0) 
(3977786.5987607674, -8197.39977027958, 4969041.230997906)
>>> transformer.to_proj4()

>>>

So for some reason it knows which transformation to use when .transform is called, but not when .to_proj4 is called

from pyproj.

romaintha avatar romaintha commented on June 16, 2024

It means that we have to upgrade our codebase? Everywhere we were using

transformer = Transformer.from_crs(in_crs, out_crs)

We need to do:

transformer = TransformerGroup(in_crs, out_crs)).transformers[0]

from pyproj.

snowman2 avatar snowman2 commented on June 16, 2024

Closing as the behavior is expected.

from pyproj.

snowman2 avatar snowman2 commented on June 16, 2024

Also see: https://proj.org/en/9.2/operations/operations_computation.html

from pyproj.

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.