Created
August 8, 2012 00:59
-
-
Save cesandoval/3291083 to your computer and use it in GitHub Desktop.
get geom type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shapefile | |
import zipfile | |
import os | |
shpTypeDict = { | |
"0":"Null Shape", | |
"1":"Point", | |
"3":"Polyline", | |
"5":"Polygon", | |
"8":"MultiPoint", | |
"11":"PointZ", | |
"13":"PolylineZ", | |
"15":"PolygonZ", | |
"18":"MultiPointZ", | |
"21":"PointM", | |
"23":"PolylineM", | |
"25":"PolygonM", | |
"28":"MultiPointM", | |
"31":"MultiPatch" | |
} | |
data = {} | |
f = "C:/GISbayarea/2/2.zip" | |
zip_file = zipfile.ZipFile(f) | |
contents = zip_file.namelist() | |
basename = os.path.splitext(contents[0])[0] | |
proj_text = zip_file.open(basename).read() | |
print proj_text | |
print basename | |
#proj = [for i in zip_file] | |
#proj_text = zip_file.open( proj[0] ) | |
shp = shapefile.Reader("C:/GISbayarea/2/parcels") | |
shp_type = shp.shapes() | |
print shpTypeDict[str(shp_type[3].shapeType)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
import shapefile
import zipfile
import os
shpTypeDict = {
"0":"Null Shape",
"1":"Point",
"3":"Polyline",
"5":"Polygon",
"8":"MultiPoint",
"11":"PointZ",
"13":"PolylineZ",
"15":"PolygonZ",
"18":"MultiPointZ",
"21":"PointM",
"23":"PolylineM",
"25":"PolygonM",
"28":"MultiPointM",
"31":"MultiPatch"
}
f = "/Users/carlos/Desktop/2.zip"
zip_file = zipfile.ZipFile(f)
contents = zip_file.namelist()
basename = os.path.splitext(contents[0])[0]
extract = zip_file.extractall()
shp = shapefile.Reader(basename).shapes()
print shpTypeDict[str(shp[3].shapeType)]