|
# profile to use with OSM_Conflator
|
|
# https://wiki.openstreetmap.org/wiki/OSM_Conflator
|
|
|
|
# examples at https://github.com/mapsme/osm_conflate/tree/master/profiles
|
|
# command to use:
|
|
# conflate --changes preview.json --output results.osm charging-stations.py
|
|
|
|
# source data preview
|
|
# https://maps.london.gov.uk/geoserver/gis/wms?service=WMS&version=1.1.0&request=GetMap&layers=gis%3Alondon_charging_stations&bbox=-0.49845770990034466%2C51.29667980345268%2C0.2505595121779243%2C51.68268223925517&width=768&height=395&srs=EPSG%3A4326&format=application/openlayers
|
|
|
|
# some related tags for charging stations
|
|
# operator=*
|
|
# capacity=*
|
|
# ref=*
|
|
# socket=*
|
|
# amperage=*
|
|
# voltage=*
|
|
# fee=yes/no
|
|
# parking:fee=yes/no/interval
|
|
# opening_hours=*
|
|
# payment=*
|
|
|
|
# source tag is audit trail back to originator
|
|
source = 'greater-london-authority'
|
|
# A fairly unique id of the dataset to query OSM, used for "ref:mos_parking" tags
|
|
# If you omit it, set explicitly "no_dataset_id = True"
|
|
dataset_id = 'london_charging_stations'
|
|
# Tags for querying with overpass api
|
|
query = [('amenity', 'charging_station')]
|
|
# Use bbox from dataset points (default). False = query whole world, [minlat, minlon, maxlat, maxlon] to override
|
|
bbox = True
|
|
# How close OSM point should be to register a match, in meters. Default is 100
|
|
max_distance = 50
|
|
# Delete objects that match query tags but not dataset? False is the default
|
|
delete_unmatched = False
|
|
# Dataset points that are closer than this distance (in meters) will be considered duplicates of each other.
|
|
duplicate_distance = 0.5
|
|
|
|
download_url = 'https://maps.london.gov.uk/geoserver/gis/ows'
|
|
|
|
def dataset(download_url):
|
|
import requests
|
|
params = dict(
|
|
srsName='EPSG:4326',
|
|
service='WFS',
|
|
version='1.0.0',
|
|
request='GetFeature',
|
|
typeName='gis:london_charging_stations',
|
|
propertyName='(latitude,longtitude,taxipublicuses,numberrcpoints,sitename)(type)',
|
|
outputFormat='application/json',
|
|
maxFeatures=500
|
|
)
|
|
download_url = 'https://maps.london.gov.uk/geoserver/gis/ows'
|
|
r = requests.get(url=download_url, params=params)
|
|
|
|
data = []
|
|
counter = 1
|
|
for el in r.json()['features']:
|
|
print(el)
|
|
# some entries were found to have no coordinates
|
|
# e.g. "sitename":"Canary Wharf (location tbd)"
|
|
if el['properties']['latitude'] != '0':
|
|
row = {
|
|
# "id": el['id'],
|
|
"id": counter,
|
|
"lat": float(el['properties']['latitude']),
|
|
"lon": float(el['properties']['longtitude']),
|
|
"tags": {
|
|
"amenity": "charging_station",
|
|
"capacity": int(el['properties']['numberrcpoints']),
|
|
# NOTE - this implementation uses the
|
|
# access:private and taxi:yes tags
|
|
# to show whether a station is restricted to taxis
|
|
"access":"private" if el['properties']['taxipublicuses'] == 'Taxi' else '',
|
|
"taxi":"yes" if el['properties']['taxipublicuses'] == 'Taxi' else '',
|
|
}
|
|
}
|
|
line = SourcePoint(row['id'],row['lat'],row['lon'],row['tags'])
|
|
data.append(line)
|
|
counter += 1
|
|
return data
|