0

I want to convert the coordinates (639117.49, 6865775.92) from EPSG:4326 to EPSG: 3949, by using the following code:

from pyproj import Proj, transform

P4326 = Proj(init='epsg:4326')
P3949 = Proj(init='epsg:3949')

x,y = transform(P4326,P3949,  639117.49, 6865775.92)

The values should be: 1639190.94757331, 8187869.9312972 but I get inf, inf.
What is the mistake?
Otherwise, can I do it directly via PostGIS without using Python?

3
  • 639117.49, 6865775.92 are not in EPSG:4326 which is in degrees between -90/90 and -180/180 so inf is the correct answer.
    – Ian Turton
    May 18, 2020 at 15:58
  • You have at least a problem with logic: your input are using thousand or millions and you expect millions. epsg:4326 min and max x are -180, +180 and min and max y are -90, +90. Before using pyproj or PostGIS to reproject, you should know what are the real input and output projections before at least one of them is 100% wrong from my 1st sentence. Your input can't be the 639117.49, 6865775.92 for epsg:4326: it's simply not possible although you try to.
    – ThomasG77
    May 18, 2020 at 16:04
  • Ah sorry!! Horrible mistake ... Thanks a lot
    – Wave1988
    May 18, 2020 at 16:24

1 Answer 1

2

Your input values look like they are in EPSG:2154 (RGF93 / Lambert-93), according to projfinder. Using this coordinate system and the point 639117.49, 6865775.92, I get a point on Rue Jacques Daguerre in Rueil-Malmaison, France. If this is the correct place then I would try the following:

from pyproj import Proj, transform

P2154 = Proj(init='epsg:2154')
P3949 = Proj(init='epsg:3949')

x,y = transform(P2154,P3949,  639117.49, 6865775.92)

With this transformation, I get values close to your desired result: 1639117.57, 8188002.59

3
  • Yes it is. Thanks a lot!!
    – Wave1988
    May 18, 2020 at 16:25
  • 2
    Would be nice to add how you inferred that projection from the data. Did you use projfinder? projfinder.com - my usual go-to for unknown projections...
    – Spacedman
    May 18, 2020 at 17:07
  • 1
    @Spacedman Indeed, I used projfinder after converting his EPSG:3949 expected value to lat/lon, and the match with EPSG:2154 was within about 100m.
    – FSimardGIS
    May 18, 2020 at 19:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.