readshapefile returns a multipolygon as several polygons
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- python
調査の方向性
エントリーポイント Basemap.readshapefile から始め、提供された Fiona の例を再現し、返されたレコードをソースジオメトリと比較します。MultiPolygon のケースが 1 つのソース feature のジオメトリとメタデータを保持し、別の Polygon のケースを壊さなければ完了です。
索引モデルが issue の本文から書いたものです。
説明
I wanted to draw a choropleth map using basemap. My plan was to read the polygons from the shapefile vis readshapefile and then further process them using shapely, descartes, etc.
The problem that I encountered was that readshapefile returned multiple polygons for each MultiPolygon. This causes confusion, as for the enclosed polygon we will have more than one record.
I think the fix will be to return a MultiPolygon instead of multiple polygons.
Here is an example:
from collections import OrderedDict
import fiona
from mpl_toolkits.basemap import Basemap
rec1 = dict()
rec2 = dict()
rec1['id'] = 0
rec1['type'] = 'Feature'
rec1['properties'] = OrderedDict([(u'NAME', 'outer'),(u'VALUE', 100)])
rec1['geometry'] = dict()
rec1['geometry']['type'] = 'MultiPolygon'
rec1['geometry']['coordinates'] = [[[(-50,40),(50,40),
(50,-40),(-50,-40),
(-50,40)
]],
[[(-45,35),(45,35),
(45,-35),(-45,-35),
(-45,35)
]]]
rec2['id'] = 1
rec2['type'] = 'Feature'
rec2['properties'] = OrderedDict([(u'NAME', 'inner'),(u'VALUE', 1)])
rec2['geometry'] = dict()
rec2['geometry']['type'] = 'Polygon'
rec2['geometry']['coordinates'] = [[(-45,35),(45,35),
(45,-35),(-45,-35),
(-45,35)
]]
driver = 'ESRI Shapefile'
crs = {'no_defs': True, 'ellps': 'WGS84', 'datum': 'WGS84', 'proj': 'longlat'}
schema = {'geometry': 'Polygon',
'properties': {'NAME': 'str',
'VALUE': 'float:15.2'}}
with fiona.open(
'/tmp/foo.shp',
'w',
driver=driver,
crs=crs,
schema=schema) as c:
c.write(rec1)
c.write(rec2)
m = Basemap()
m.readshapefile('/tmp/foo','foo')
for info,region in zip(m.foo_info, m.foo):
print info
print region
for which the output is:
{'RINGNUM': 1, 'NAME': 'outer', 'VALUE': 100.0, 'SHAPENUM': 1}
[(-50.0, 40.0), (50.0, 40.0), (50.0, -40.0), (-50.0, -40.0), (-50.0, 40.0)]
{'RINGNUM': 2, 'NAME': 'outer', 'VALUE': 100.0, 'SHAPENUM': 1}
[(-45.0, 35.0), (-45.0, -35.0), (45.0, -35.0), (45.0, 35.0), (-45.0, 35.0)]
{'RINGNUM': 1, 'NAME': 'inner', 'VALUE': 1.0, 'SHAPENUM': 2}
[(-45.0, 35.0), (45.0, 35.0), (45.0, -35.0), (-45.0, -35.0), (-45.0, 35.0)]
- 主要言語
- Python
- スター
- 818
- フォーク
- 395
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
matplotlib/basemap のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
matplotlib/basemap#368 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
matplotlib/basemap#655 ·
-
Python 3.14 wheelsオープン
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
matplotlib/basemap#652 · コメント 2 件 · リアクション 5 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
matplotlib/basemap#649 · リアクション 2 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
matplotlib/basemap#646 ·
matplotlib/basemap の issue をすべて見る
似ている issue
-
good first issue hacktoberfest
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
RogueAlg0/taken#387 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
tool-calling
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
vllm-project/vllm#59838 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
raullenchai/Rapid-MLX#4042 ·
メンテナーはふだん 1 日以内に返信
-
documentation
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
transitmatters/mbta-slow-zone-bot#70 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
open-webui/open-webui#31871 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信