# How to convert a point from a given 2D crs to another one

**URL:** <https://discourse.julialang.org/t/how-to-convert-a-point-from-a-given-2d-crs-to-another-one/114549>\
**Category:** Geo\
**Tags:** coordinates\
**Created:** [May 22, 2024, 8:18am UTC](https://discourse.julialang.org/t/how-to-convert-a-point-from-a-given-2d-crs-to-another-one/114549 "2024-05-22T08:18:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Post date:** [May 22, 2024, 8:18am UTC](https://discourse.julialang.org/t/how-to-convert-a-point-from-a-given-2d-crs-to-another-one/114549/1 "2024-05-22T08:18:41Z")

</div>

I thought it would be easy, but I can’t find a way to programmatically convert (and extract the X,Y values) a 2D point from a given well known reference point to another one.

For example, I have a point in “EPSG:4326”, the geographical coordinates system of the WGS 84 ellipsoid, and I want it in “EPSG:3035” (projected with metric unit).

So Paris (lon 2.35, lat: 48.85) would become X: 3760537, Y: 2888771

I have tried `Proj4.transform` but it applies to points that have been created with the `Projection` constructor that in turn uses some string format I don’t understand.

---

<div class="post-metadata">

**Author:** ![evetion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/evetion/32/22679_2.png) [@evetion](https://discourse.julialang.org/u/evetion)\
**Post date:** [May 22, 2024, 8:26am UTC](https://discourse.julialang.org/t/how-to-convert-a-point-from-a-given-2d-crs-to-another-one/114549/2 "2024-05-22T08:26:56Z")

</div>

Does the [README](https://github.com/JuliaGeo/Proj.jl) of Proj.jl, or the topic [Converting UK National Grid to Lat Lon and vice versa](https://discourse.julialang.org/t/converting-uk-national-grid-to-lat-lon-and-vice-versa/109628) help with their examples?

---

<div class="post-metadata">

**Author:** ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Post date:** [May 22, 2024, 8:40am UTC](https://discourse.julialang.org/t/how-to-convert-a-point-from-a-given-2d-crs-to-another-one/114549/3 "2024-05-22T08:40:39Z")

</div>

Yes, at the end…

```julia
using Proj
trans = Proj.Transformation("EPSG:4326", "EPSG:3035", always_xy=true)
(X,Y) = trans(2.35,48.85)

```

My issue is that for the first time I started by asking ChatGPT (paid version) and it sent me completely out of course with old packages and not working code that I tried to debug… I lost many hours, what a lesson…

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [May 22, 2024, 9:05am UTC](https://discourse.julialang.org/t/how-to-convert-a-point-from-a-given-2d-crs-to-another-one/114549/4 "2024-05-22T09:05:32Z")

</div>

If you seek a native Julia solution, take a look into CoordRefSystems.jl

---

<div class="post-metadata">

**Author:** ![evetion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/evetion/32/22679_2.png) [@evetion](https://discourse.julialang.org/u/evetion)\
**Post date:** [May 22, 2024, 9:15am UTC](https://discourse.julialang.org/t/how-to-convert-a-point-from-a-given-2d-crs-to-another-one/114549/5 "2024-05-22T09:15:32Z")

</div>

It seems the requested CRS EPSG:3035 is not yet supported? But maybe I’m doing something wrong.

```julia
julia> CoordRefSystems.get(EPSG{3035})
ERROR: MethodError: no method matching get(::Type{EPSG{3035}})

```

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [May 22, 2024, 9:19am UTC](https://discourse.julialang.org/t/how-to-convert-a-point-from-a-given-2d-crs-to-another-one/114549/6 "2024-05-22T09:19:24Z")

</div>

Didnt check. It may be just a missing method in the CoordRefSystems.get function. It points to the correct CRS type in the [epsg.io](http://epsg.io) catalogue:

> <https://github.com/JuliaEarth/CoordRefSystems.jl/blob/118243977ce5ff114819e84cb5b60813f45d79b4/src/codes.jl#L30-L43>

CoordRefSystems.jl already supports most (if not all practical) projections from PROJ.

---

<div class="post-metadata">

**Author:** ![evetion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/evetion/32/22679_2.png) [@evetion](https://discourse.julialang.org/u/evetion)\
**Post date:** [May 22, 2024, 9:49am UTC](https://discourse.julialang.org/t/how-to-convert-a-point-from-a-given-2d-crs-to-another-one/114549/7 "2024-05-22T09:49:27Z")

</div>

Ah, I think I misunderstood the type of projection you’re referring to. Since this is off-topic, I’ve made an [issue](https://github.com/JuliaEarth/CoordRefSystems.jl/issues/78).
