Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question
2  
gdal.org/index.html will convert shp to gml –  Mapperz Sep 26 '12 at 15:08
add comment

1 Answer

up vote 5 down vote accepted

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....

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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