简体   繁体   English

从 shapefile 将 EPSG 3035 转换为 EPSG 4326(lon lat)

[英]Translate EPSG 3035 to EPSG 4326(lon lat) from shapefile

I have a dataset in a shapefile with CRS: EPSG 3035, which is the extent is xmax,xmin,ymax,ymin.我在带有 CRS 的 shapefile 中有一个数据集:EPSG 3035,其范围是 xmax、xmin、ymax、ymin。 I'm struggling to translate it into long and lat format.我正在努力将其翻译成 long 和 lat 格式。 Do you know how to solve this?你知道如何解决这个问题吗?

Thanks谢谢

You can do this in Python using a library called GeoPandas .您可以使用名为GeoPandas的库在 Python 中执行此操作。 Here is the sample code:这是示例代码:

# Imports the library
import geopandas as gpd

# String that points to the location of the
# shapefile on disk
input_file = 'path\to\file.shp'

# String that contains the filename of the 
# new/transformed shapefile
output_file = 'path\to\new_file.shp'

# Creates a GeoDataFrame which you can manipulate
my_data = gpd.read_file(input_file)

# Transforms the data to the new reference system
new_data = my_data.to_crs('epsg:4326')

# Exports the newly-created file
new_data.to_file(output_file)

If you want to do this in R, here is the appropriate code:如果您想在 R 中执行此操作,以下是相应的代码:

# Install spatial data packages
install.packages("rgdal")

# Load spatial data packages
library(rgdal)

# String that points to the location of the
# input shapefile on disk
input_file = 'path/to/file/my_shapefile.shp'

# Strings that point to the filename of the 
# new/transformed shapefile that will be generated
output_folder = 'path/to/file'
output_file   = 'new_shapefile.shp'

# Creates a SpatialLinesDataFrame which you can manipulate
my_data = readOGR(input_file)

# Transforms the data to the new reference system
new_data = spTransform(my_data,CRS("+init=epsg:4326"))

# Exports the newly-created file
writeOGR(new_data, dsn=output_folder,layer=output_file, driver="ESRI Shapefile")

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 EPSG3035 中读取 shapefile 以在 WGS84 中获得 long/lat 的 Geotools 解决方案? - Geotools solution to read shapefile in EPSG3035 to get long / lat in WGS84? 使用 ccrs.epsg() 使用 EPSG 4326 坐标系绘制邮政编码周长形状文件 - Use ccrs.epsg() to plot zipcode perimeter shapefile with EPSG 4326 coordinate system 如何将 shapefile 中的信息从多边形转换为纬度/经度 - How to convert the information from a shapefile from polygon to lat/lon 是否可以使用js或php从具有pt数字,lat,lon,elev和说明的csv创建shapefile? - Is it possible to create a shapefile from a csv with pt numbers, lat, lon, elev, and description using js or php? 从具有多边形/区域和点(纬度,经度)的shapefile中,找出每个点属于哪个多边形/区域? 在R中 - From a shapefile with polygons/areas, and points (lat,lon), figure out which polygon/area each point belongs to? In R 在R中使用shapefile过滤纬度点 - Filter lat-lon points using shapefile in R 在LON / LAT中使用Leaflet> NULL值读取readOGR点shapefile和图 - readOGR point shapefile and plot using Leaflet > NULL values in LON/LAT 测试 R 中的 shapefile 中是否存在纬度/经度对 - Test whether lat/lon pairs exist within a shapefile in R 为什么没有从正上方查看我的 GIS Shapefile (CRS 4326)? - Why is my GIS Shapefile (CRS 4326) not viewed from directly above? 了解我的shapefile的坐标点(不是纬度/经度)以及为什么空间连接不起作用 - Understanding my shapefile's coordinate points (not lat/lon) and why spatial joins own't work
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM