2

I would like to plot a marker using the Folium library but the data I have is in ETRS89 and Folium does not accept that projection. I am having problems transforming from EPSG25830 (ETRS89) to EPSG3857. I have read and followed step by step the tutorial in PyProj web and different ways of declaring the projections but something does not add up.

My code is:

from pyproj import CRS
from pyproj import Transformer

crs_in = CRS.from_epsg("25830") crs_out = CRS.from_epsg("3857")

transformer = Transformer.from_crs(crs_in, crs_out) print(transformer.transform(582040.535326,4.797240e+06))

(-221319.72875795467, 5361346.317915058)

That is weird because it should look like 43.259404, -2.026318 (not the same point, but very close) so I check the other way around:

  transformer_inv = Transformer.from_crs(crs_out, crs_in)
  print(transformer_inv.transform(43.259404, -2.026318))
  (834021.8587713321, -2.0147284128379286)

I do not understand what is happening or where I am wrong.

Victoregb
  • 23
  • 3
  • 2
    Not clear what you want to achieve. Your target coords are lat/lon but both the epsg codes you use are projected E/N grids. 25830 is not etrs89. It is utm 30n on the etrs89 datum. – JimT Feb 27 '21 at 08:52
  • @JimT thank you for your comment. I have a lot to learn and I thought they were the same because of what I understood here: https://spatialreference.org/ref/epsg/25830/ I will try to be clearer in future questions. – Victoregb Feb 27 '21 at 15:09

1 Answers1

2

You probably want 4326 (4326 is just the EPSG identifier of WGS84, latitude and longitude in degrees, which it looks like you are expecting), those numbers look approximately right for 3857 (Web Mercator)

If your numbers are latitude/longitude: 43.259404, -2.026318; that is on the coast of Spain.

Your result on an OpenLayers map (which defaults to EPSG3857)

enter image description here

more information:

geocodezip
  • 316
  • 1
  • 4
  • 9