Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Convert between projections epsg:25830 and epsg:4326 used in INE (Instituto Nacional de Estadística, Spain)
# returns latlng
def get_maxmin_latlon_region(region):
lon_max = -180
lon_min = 180
lat_max = -90
lat_min = 90
if region['type'] == 'Polygon':
for polygon in region['coordinates']:
for point in polygon:
point = translate_projections(point)
if point[0] > lon_max: lon_max = point[0]
if point[0] < lon_min: lon_min = point[0]
if point[1] > lat_max: lat_max = point[1]
if point[1] < lat_min: lat_min = point[1]
return [lat_max,lon_max,lat_min,lon_min]
# returns latlng
def translate_projections(point):
inProj = Proj(init='epsg:25830')
outProj = Proj(init='epsg:4326')
x2,y2 = transform(inProj,outProj,point[0],point[1])
return [y2,x2]

This comment has been minimized.

Copy link

commented Mar 20, 2019

Buenas @Saigesp,
no debería estar aquí la función "transform", a la que le envías inProj, outProj, point[0] y point[1], para que el código estuviera completo y fuera funcional?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.