Created
March 20, 2020 23:48
-
-
Save simboli/a63a4fafdacd4a2e62ed6be76d17b0b8 to your computer and use it in GitHub Desktop.
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
# Dictionary for features data | |
neighbours_multply = [] | |
# List for polygon names | |
neighbours_names = [] | |
def GeoClass_LoadFile(fname): | |
global GeoData | |
with open(fname, encoding="utf-8") as geoJsonFile: | |
GeoData = json.load(geoJsonFile) | |
def GeoClass_BuildPolygon(): | |
global neighboursPolygon | |
for neighbours in GeoData['features']: | |
if neighbours.get('properties').get('type')=='boundary': | |
neighbours_shape = asShape(neighbours['geometry']) | |
neighbours_multply.append(neighbours_shape) | |
neighbours_names.append(neighbours['properties']['name']) | |
neighboursPolygon = MultiPolygon(neighbours_multply) | |
def GeoClass_GetPName(point): | |
i=0 | |
while i < len(neighbours_names): | |
if neighboursPolygon[i].contains(point): | |
Resp=neighbours_names[i] | |
i+=1 | |
return Resp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment