I have a shp file with the latitudes and longitudes for the boundaries for various geographic regions. I'd like to convert the shp file into lists of just latitudes and longitudes for the regions. I'll then use these lists in my program to determine which region a specific point resides in. Is there a quick way to do this conversion or will I have to read up on the APIs? Even converting the shp file into GML would be a help as I could easily access that programmatically.


You can use Python shapefile library pyshp

>>> import shapefile
>>> sf = shapefile.Reader("shapefiles/blockgroups")
>>> shapes = sf.shapes()
>>> # Read the bounding box from the 4th shape
>>> shapes[3].bbox
[-122.485792, 37.786931000000003, -122.446285, 37.811019000000002]
>>>#  Read the 8th point in the 4th shape
>>> shapes[3].points[7]
[-122.471063, 37.787402999999998]

i hope it helps you....

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.