首页 > 其他分享 >【847】create geoDataFrame from dataframe

【847】create geoDataFrame from dataframe

时间:2023-06-30 09:00:10浏览次数:39  
标签:847 POINT df create Coordinates method dataframe wkt

Ref: From WKT format

Firstly, we already have a dataframe, and there is a column of geometry. But this column is in the format of the string, therefore, we should change the data format from the string to the polygon.

There are two ways to implement this method.

The first method,

df = pd.DataFrame(
    {
        "City": ["Buenos Aires", "Brasilia", "Santiago", "Bogota", "Caracas"],
        "Country": ["Argentina", "Brazil", "Chile", "Colombia", "Venezuela"],
        "Coordinates": [
            "POINT(-58.66 -34.58)",
            "POINT(-47.91 -15.78)",
            "POINT(-70.66 -33.45)",
            "POINT(-74.08 4.60)",
            "POINT(-66.86 10.48)",
        ],
    }
)

from shapely import wkt

df["Coordinates"] = wkt.loads(df["Coordinates"])

gdf = geopandas.GeoDataFrame(df, geometry="Coordinates")

The second method,

df["Coordinates"] = geopandas.GeoSeries.from_wkt(df["Coordinates"])

gdf = geopandas.GeoDataFrame(df, geometry="Coordinates")

 <iframe class="ginger-extension-definitionpopup" style="left: 44px; top: 100px; z-index: 2147483646; display: none"></iframe>

标签:847,POINT,df,create,Coordinates,method,dataframe,wkt
From: https://www.cnblogs.com/alex-bn-lee/p/17515684.html

相关文章

  • gmap构建离线地图,用createCustomerTiledLayer方法,瓦片地址尾部多了 ?x={x}&y={y}&z&{z
    gmap构建离线地图,用createCustomerTiledLayer方法,瓦片地址尾部多了?x={x}&y={y}&z&{z}导致无法显示地图。functioninitMap(){this.map=newGL.Map('map',{center:"120.650847,31.3092434",zoom:12,zoomControl:f......
  • Handle Table 及 ObCreateHandle 相关随笔
    文章来源于对 https://rayanfam.com/topics/reversing-windows-internals-part1/的理解。1. HandleTable结构体如下所示(Win10,x64,Intel)kd>dtnt!_HANDLE_TABLE+0x000NextHandleNeedingPool:Uint4B+0x004ExtraInfoPages:Int4B+0x008TableCode......
  • transformCreateStmt 函数源码分析
    函数transformCreateStmt功能在执行器阶段对createtable命令做一些处理:列属性处理条件限制处理likeClause处理如果需要,给表名加上当前schema的名字等等。。。函数签名List*transformCreateStmt(CreateStmt*stmt,constchar*queryString)输入参数CreateSt......
  • 从2PC和容错共识算法讨论zookeeper中的Create请求 | 京东云技术团队
    最近在读《数据密集型应用系统设计》,其中谈到了zookeeper对容错共识算法的应用。这让我想到之前参考的zookeeper学习资料中,误将容错共识算法写成了2PC(两阶段提交协议),所以准备以此文对共识算法和2PC做梳理和区分,也希望它能帮助像我一样对这两者有误解的同学。1.2PC(两阶段提交协议)两......
  • 从2PC和容错共识算法讨论zookeeper中的Create请求
    最近在读《数据密集型应用系统设计》,其中谈到了zookeeper对容错共识算法的应用。这让我想到之前参考的zookeeper学习资料中,误将容错共识算法写成了2PC(两阶段提交协议),所以准备以此文对共识算法和2PC做梳理和区分,也希望它能帮助像我一样对这两者有误解的同学。1.2PC(两阶段提交协议......
  • ltgtt_create_temp_table 实现逻辑分析
    本文主要分析lightdb全局临时表实现时使用到的函数ltgtt_create_temp_table.通过makeNode函数创建TableLikeClause和CreateStmt.createtablelt_gtt_schema_123456_6.g_foo(likepublic.g_foo);TableLikeClause对应上面的(likepublic.g_foo);CreateStmt对应上......
  • create-react-app 除了NODE_ENV如何区分环境变量
    比如webpack打包的时候,可能要打包到测试环境或者生产环境,但是这时候NODE_ENV的值都是production,这个时候如何区分呢。答案是:cross-env和webpack.DefinePlugin1.定义环境变量到编译环境:测试环境: cross-envNODE_STAGE=testnpmrunbuild预上线: cross-envNODE_STAGE=s......
  • P8477 「GLR-R3」春分 题解
    更好的阅读体验牛逼逼题。Subtask1直接暴力,每个实验配一块板。需要\(n^2\)块板。cout<<n*n<<'\n';for(inti=1;i<=n;++i){for(intj=1;j<=n;++j){cout<<"1"<<i<<''<<++c<......
  • Ubuntu提示【Authentication is required to create a color profile/managed device
    1.安装vimaptinstallvim-y2.修改文件 vim/etc/polkit-1/localauthority/50-local.d/45-allow-colord.pkla3.粘贴以下内容[AllowColordallUsers]Identity=unix-user:*Action=org.freedesktop.color-manager.create-device;org.freedesktop.color-manager.create-......
  • create build make generate 的区别
    在英语中,create、build、make、generate都可以表示“创造”或“制造”的意思,但它们的用法略有不同。其中,create与make的语意范围有相当的重叠,两者都可用来表示“从无到有”的“创造”或“制造”,但create更强调创造出新事物的过程,而make更强调制造出实用的东西。build则更......