开发者

Shapefile reader in Python?

Are there any libraries that I can use to read a shp/shx/dbf/sbx set of files? I mainly need to extract some pol开发者_开发知识库ygons but something that lets me extract any data that I want would be awesome.


The pyshp library should be good.


To use the Python Shapefile Library download shapefile.py: http://code.google.com/p/pyshp/source/browse/trunk/shapefile.py

Place it in your working directory or in your Python site-packages directory and you are ready to go.

Just type "import shapefile" in your interpreter or python script and follow usage examples and documentation at the PyShp project on Google Code.


GDAL includes the OGR library which supports shapefile I/O. However, the installation process for this package in Windows is not very straightforward.


Also PySAL could be of some help. Reads shape files:

import pysal
shp = pysal.open('YOUR_FILE.shp')

And plenty of others geo related formats.


Shapelib is also a good choice; it has c, c++, c# and python interface: http://shapelib.maptools.org/

and pyshapelib here: http://ftp.intevation.de/users/bh/pyshapelib/


The problem with the shapefile library is that the package not abled to access the details in the file

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜