using osm conflate, cf_audit and josm to syndicate and moderate open spatial data releases to osm https://wiki.openstreetmap.org/wiki/Import/London/Greater_London_Authority/Charging_Stations
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 

84 lines
3.6 KiB

# 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-improved-version.json --output results-improved-version.osm charging-stations-improved-version.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:env_ev_charging_site',
propertyName='(location,site_type,operation_time,operator,access,operator_type,nb_of_rcps,operation_time2)(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']:
# some entries were found to have no coordinates
# e.g. "sitename":"Canary Wharf (location tbd)"
if len(el['geometry']['coordinates']) == 2:
row = {
## NOTE the id has to be numeric to create, but can be later replaced in the
# tags.ref:london_charging_stations tag with something like the location field, which is more uniquely identifiying
"id": counter,
"lat": float(el['geometry']['coordinates'][1]),
"lon": float(el['geometry']['coordinates'][0]),
"tags": {
"ref":el['properties']['location'],
"opening_hours": el['properties']['operation_time2'],
"operator": el['properties']['operator'],
"amenity": "charging_station",
"capacity": int(el['properties']['nb_of_rcps']),
# 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']['access'] == 'Taxi only' else '',
"taxi":"yes" if el['properties']['access'] == 'Taxi only' else '',
}
}
line = SourcePoint(row['id'],row['lat'],row['lon'],row['tags'])
data.append(line)
counter += 1
return data