>>> import struct >>> fichier='testpoly.shp' >>> f = open(fichier,'rb') >>> shpread = f.read(100) #lecture des 100 premiers bytes >>> shptype = struct.unpack('<l',shpread[32:36]) #type de shape >>> print shptype[0] 5 # 5 = polygone, voir tableau de correspondance dans Wikipedia >>> box = struct.unpack('<dddd',shpread[36:68]) # cadre global du shapefile >>> print box (-0.009020000000000002, -0.0050160000000000005, 0.0055000000000000014, 0.007392000000000001)
python_shp
- 6432 lectures