Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/330.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在ubuntu上使用geopandas和python直接从postgis绘制几何图形_Python_Postgis_Postgresql 9.4 - Fatal编程技术网

在ubuntu上使用geopandas和python直接从postgis绘制几何图形

在ubuntu上使用geopandas和python直接从postgis绘制几何图形,python,postgis,postgresql-9.4,Python,Postgis,Postgresql 9.4,我尝试使用geopandas和python从postgis绘制几何图形,但没有得到任何结果(没有错误,没有结果)。 这是我使用的代码,我遗漏了什么吗 import psycopg2 import geopandas as gpd import matplotlib.pyplot as plt try: conn = psycopg2.connect("dbname='strokes' user='postgres' host='localhost' password='admin'"

我尝试使用geopandas和python从postgis绘制几何图形,但没有得到任何结果(没有错误,没有结果)。 这是我使用的代码,我遗漏了什么吗

import psycopg2
import geopandas as gpd 
import matplotlib.pyplot as plt

try:
    conn = psycopg2.connect("dbname='strokes' user='postgres' host='localhost' password='admin'")
except:
    print "I am unable to connect to the database"
ba = gpd.GeoDataFrame.from_postgis("SELECT ST_AsText(geom) AS wkt, fid_limite, nombassin FROM bassin", conn, geom_col ='geometry', crs={'init': 'epsg:4326'}, coerce_float=True)
    conn.commit()
    conn.close()
    ba.head
    ba.plot(column='nombassin', categorical=True, legend=True, figsize=(14,6));
    plt.show()