Geopandas PostGIS connection

后端 未结 1 647
青春惊慌失措
青春惊慌失措 2021-02-04 08:14

I recently started using Geopandas in python for some of my spatial work and am very pleased with it - I\'m currently trying to read in PostGIS features and don\'t quite underst

相关标签:
1条回答
  • 2021-02-04 08:47

    Example:

    import geopandas as gpd
    
    import psycopg2  # (if it is postgres/postgis)
    
    con = psycopg2.connect(database="your database", user="user", password="password",
        host="your host")
    
    sql = "select geom, x,y,z from your_table"
    
    df = gpd.GeoDataFrame.from_postgis(sql, con, geom_col='geom' )
    
    0 讨论(0)
提交回复
热议问题