首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将latlong更改为UTM坐标。错误:必须是实数,而不是str。

将latlong更改为UTM坐标。错误:必须是实数,而不是str。
EN

Stack Overflow用户
提问于 2018-12-09 08:56:50
回答 1查看 487关注 0票数 0

要将csv数据从Latlong (学位)更改为UTM坐标有问题。这是示例数据:

代码语言:javascript
复制
Date        Time    Latitude  Longitude
23/08/2018  9:00:00 -5.1661   119.4543
23/08/2018  9:00:01 -5.166    119.4544
23/08/2018  9:00:02 -5.1659   119.4544
23/08/2018  9:00:07 -5.1657   119.4546
23/08/2018  9:00:42 -5.162    119.4567
23/08/2018  9:00:43 -5.1614   119.4567
23/08/2018  9:00:44 -5.16     119.4548

我试着用这种方法改变坐标

代码语言:javascript
复制
df = pd.read_csv("data.csv")
s = gpd.GeoSeries([Point(x,y) for x, y in zip(df['Longitude'], df['Latitude'])])
geo_df = gpd.GeoDataFrame(df[['Date','Time']], geometry=s) 
geo_df.crs = {'init': 'epsg:4326'} 
geo_df = geo_df.to_crs({'init': 'epsg:32750'})
geo_df

但我有TypeError: must be real number, not str

有什么办法解决这个问题吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-12-09 09:33:41

也许这会有帮助

代码语言:javascript
复制
geometry = [Point(xy) for xy in zip(df.Latitude, df.Longitude)]
df = df.drop(['Latitude', 'Longitude'], axis=1)
crs = {'init': 'epsg:4326'}
gdf = gpd.GeoDataFrame(df, crs=crs, geometry=geometry)
gdf = gdf.to_crs({'init': 'epsg:32750'})

查看这里这里以获得更多详细信息

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53690750

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档