Skip to content

Instantly share code, notes, and snippets.

@simboli
Created March 20, 2020 23:48
Show Gist options
  • Save simboli/a63a4fafdacd4a2e62ed6be76d17b0b8 to your computer and use it in GitHub Desktop.
Save simboli/a63a4fafdacd4a2e62ed6be76d17b0b8 to your computer and use it in GitHub Desktop.
# 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