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

Some locations aren't being found in boundary data. #115

Closed Mike-Heneghan closed 5 years ago

Mike-Heneghan commented 5 years ago

There have been instances where a location longitude is used to search the features of a data sets and no matches have been returned.

for location_id, long_lat in location_long_lats.items():
        match = find_boundary_matches(boundary, long_lat)
        if len(match) > 0:
            region = match[0]['name']
            service_area[region].append(location_id)

Find boundary matches:

def find_boundary_matches(boundary, long_lat):
    with open(boundary['data_file_path']) as f:
        js = json.load(f)
    point = Point(long_lat)
    boundary_matches = []
    data_set_keys = boundary['data_set_keys']
    for feature in js['features']:
        polygon = shape(feature['geometry'])
        if polygon.contains(point):
            boundary_matches.append({
            'code-type':data_set_keys['data_set_name'],
            'code':feature['properties'][data_set_keys['code']],
            'name':feature['properties'][data_set_keys['name']],
            })
    return boundary_matches
Mike-Heneghan commented 5 years ago

This has not previously been an issue and could potentially have been introduced with the clipping of data? The boundary data sets should have a service area for all of Scotland. Whether it is health boundary data set of local council authorities. For a location in Scotland, the appropriate service area should be returned.

Mike-Heneghan commented 5 years ago

Another potential option would be that some locations aren't in Scotland so are therefore not appearing within Scottish boundary data sets.

Mike-Heneghan commented 5 years ago

Began printing out locations which aren't matched to service areas and noticing a trend of them being at the edge of boundaries for example coastlines which are more likely to be lost in lower resolution geospatial data.

Mike-Heneghan commented 5 years ago

Also found locations that when searched with google maps appear to be off the coast and in water or outside Scotland (London for example).

Mike-Heneghan commented 5 years ago

Could add an extra variable which would be the unmatched locations to get a better understanding of the locations which aren't being recorded.

Mike-Heneghan commented 5 years ago

Merged into master