Mike-Heneghan / ALISS

ALISS (A Local Information System for Scotland) is a service to help you find help and support close to you when you need it most.
https://aliss.org
0 stars 0 forks source link

Boundary geocoder #76

Closed digitalWestie closed 5 years ago

digitalWestie commented 5 years ago

In the following folder there's ruby code for determining the local authority a set of coordinates are found in:

https://github.com/openactive/api-dashboard/tree/master/lib/local_geocoder

It uses a ruby library called 'local-geocoder' which provides a geometry class with a contains_point? method.

The goal here would be to write equivalent version, but in python. It's possible someone has done this before so first step is to research code elsewhere.

This above example is fixed to UK local authorities, whereas we want to work to something a bit more abstract if possible.

Edit- it looks like the shapely library is the one we're after:

https://stackoverflow.com/questions/20776205/point-in-polygon-with-geojson-in-python

Mike-Heneghan commented 5 years ago

Spatial Data: https://spatialdata.gov.scot/geonetwork/srv/eng/catalog.search;jsessionid=C2E7BCE5BCC10F4E43717825B3982CC5#/metadata/f12c3826-4b4b-40e6-bf4f-77b9ed01dc14

Geodecoder: https://mygeodata.cloud/converter/wfs-to-geojson

Mike-Heneghan commented 5 years ago

Objective is an array of boundary data matches:

[{'code-type':'local_authority', 'code':'S12000046', 'name': 'Glasgow City' }, {{'code-type':'health_board', 'code':'S08000021', 'name': 'Glasgow Area } ]

Mike-Heneghan commented 5 years ago

Geo Data for Scottish Local Authorities:

Mike-Heneghan commented 5 years ago

The ultimate goal of the feature is:

Mike-Heneghan commented 5 years ago
Mike-Heneghan commented 5 years ago

To do:

Mike-Heneghan commented 5 years ago

Required methods:

Mike-Heneghan commented 5 years ago

Download QGIS version=3.4.8 and try to process the Health Board boundary data and convert into the correct format.

Screenshot 2019-06-04 at 11 54 10 Screenshot 2019-06-04 at 11 55 16 Screenshot 2019-06-04 at 11 56 17
Mike-Heneghan commented 5 years ago

Health Integration Authorities (HSCP):

https://spatialdata.gov.scot/geonetwork/srv/eng/catalog.search;jsessionid=B56BC78E7E3D46F6847E18A7AF298975#/metadata/ac5e870f-8fc2-4c21-8b9c-3bd2311a583f

Mike-Heneghan commented 5 years ago

Now a long_lat can be passed in as an argument to check_boundaries and an object of all matching boundaries is returned.

Mike-Heneghan commented 5 years ago

Refactor the boundary_mappings as dictionaries and remove the unnecessary repetition of long_lat

Mike-Heneghan commented 5 years ago

Merge into master