2
ogr pythonを使用してベクターシェープファイルをバッファーする方法
http://www.naturalearthdata.com/downloads/50m-cultural-vectors/から国と居住場所のデータセットを使用してPythonでOGRを使用する方法を学習しようとしています。フィルターとバッファーを使用して、指定された国の指定されたバッファー(ne_50m_admin_0_countries.shpのフィーチャクラスADMINからフィルター)内のポイント(ne_50m_populated_places.shp)を見つけようとしています。問題は、buffer()に使用するユニットが理解できないことです。スクリプトでは、スクリプトが機能するかどうかをテストするために、任意の値10を使用しました。スクリプトは実行されますが、名前が付けられた国「アンゴラ」のカリブ地域周辺の人口の多い場所を返します。理想的には、バッファ距離を指定できるようにしたいのですが(たとえば500km)、buffer()がwgs84 lat / long形式であるcountrys.shpの単位を使用していることがわかっているので、これを行う方法を理解できません。これを達成するための方法についてのアドバイスをいただければ幸いです。 # import modules import ogr, os, sys ## data source os.chdir('C:/data/naturalearth/50m_cultural') # get the shapefile driver driver = ogr.GetDriverByName('ESRI Shapefile') # open ne_50m_admin_0_countries.shp and get the layer admin = driver.Open('ne_50m_admin_0_countries.shp') if admin is None: print 'Could not open ne_50m_admin_0_countries.shp' sys.exit(1) adminLayer = admin.GetLayer() # open ne_50m_populated_places.shp …