我使用pysal / cenpy提取了地理信息,但是对象通过调用质心返回了错误
import cenpy as cen
import pysal as ps
import geopandas as gpd
dataset = 'ACSSF5Y2015'
con = cen.base.Connection(dataset)
con.set_mapservice('tigerWMS_ACS2017')
geotmp = con.mapservice.query(layer=84, where='STATE=' + str(1))
type(geotmp)
#pandas.core.frame.DataFrame
type(geotmp.geometry[0])
#pysal.cg.shapes.Polygon
geotmp.geometry.centroid
AttributeError: 'Series' object has no attribute 'centroid'
的内置数据集中进行了检查
type(data_table)
#pandas.core.frame.DataFrame
type(data_table.geometry[0])
#pysal.cg.shapes.Polygon
data_table.geometry[0].centroid
#(-94.90336786329912, 48.771730563701574)
如何更正错误?
答案 0 :(得分:0)
尽管这不能直接回答您的问题,但有一个ffmpeg -i input.mp4 -vf "drawtext=enable='between(t,0,5)':fontfile=font.ttf:text='Some caption':x=60:y=640:fontsize=40:fontcolor=#f0f0f0@0.9" -vcodec libx264 -crf 27 -preset ultrafast -strict -2 -acodec copy output.mp4
的较新的预发行版本,它更加简化,可以避免您上面描述的问题(请参见下面的示例)。 Instructions for installing the pre-release can be found here和a gist demonstrating functionality here。
cenpy
import cenpy
cenpy.__version__
>>> '1.0.0dev'
florida = cenpy.products.Decennial2010().from_state('Florida')
>>> Matched: Florida to Florida, FL within layer States
type(florida)
>>> geopandas.geodataframe.GeoDataFrame
type(florida.geometry[0])
>>> shapely.geometry.polygon.Polygon
print(florida.geometry[0].centroid)