I am trying to map which county a set of coordinates I have are in. I want the code to go through each coordinate, check which county it is in, and then print the corresponding county. However, currently when ran the cursor in idle just flashes and nothing appears to happen. Any help with where my code might be going wrong would be greatly appreciated. I'm not sure if the code is correctly checking the counties or whether it can get the the names of the counties from the shapefile?
import pysal as psfrom ast import literal_evalCOUNTIES = '/Users/JoshuaHawley/Desktop/counties/English Ceremonial Counties.shp'shps = ps.open(COUNTIES)counties = shps.read()f = open('/Users/JoshuaHawley/sundayCoordinates.txt').read()seq = literal_eval(f.replace("\n", ","))coordinates = seq[0:]for line in coordinates: points = coordinates[:2]NotFound = Truewhile NotFound == True: if coordinates in counties: NotFound = False name_of_county = counties.getNamePolygon() print(name_of_county)
أكثر...
import pysal as psfrom ast import literal_evalCOUNTIES = '/Users/JoshuaHawley/Desktop/counties/English Ceremonial Counties.shp'shps = ps.open(COUNTIES)counties = shps.read()f = open('/Users/JoshuaHawley/sundayCoordinates.txt').read()seq = literal_eval(f.replace("\n", ","))coordinates = seq[0:]for line in coordinates: points = coordinates[:2]NotFound = Truewhile NotFound == True: if coordinates in counties: NotFound = False name_of_county = counties.getNamePolygon() print(name_of_county)
أكثر...