Browse Source

tidied geojson feature id and improved readme

master
joseph.leach 5 years ago
parent
commit
69a5676900
7 changed files with 655 additions and 614 deletions
  1. +1
    -0
      Pipfile
  2. +18
    -4
      Pipfile.lock
  3. +42
    -23
      README.md
  4. +15
    -10
      charging-stations.py
  5. +576
    -576
      preview.json
  6. +2
    -0
      requirements.txt
  7. +1
    -1
      results.osm

+ 1
- 0
Pipfile View File

@ -7,6 +7,7 @@ verify_ssl = true
[packages]
requests = "*"
osm-conflate = "*"
[requires]
python_version = "3.7"

+ 18
- 4
Pipfile.lock View File

@ -1,7 +1,7 @@
{
"_meta": {
"hash": {
"sha256": "bb57e0d7853b45999e47c163c46b95bc2fde31c527d8d7b5b5539dc979444a6d"
"sha256": "85d43b4e8d458480d4fb4850a8c2632ffa3b31fc630325889213e075578f16ed"
},
"pipfile-spec": 6,
"requires": {
@ -37,6 +37,20 @@
],
"version": "==2.8"
},
"kdtree": {
"hashes": [
"sha256:083945db69bc3cf0d349d8d0efe66c056de28d1c2f1e81f762dc5ce46f0dcf0a",
"sha256:386df6c7816a05e0fab974e3035df944f99ef68b5615f4a416771391e33d7534"
],
"version": "==0.16"
},
"osm-conflate": {
"hashes": [
"sha256:317523ab484c2e7101d92374e2f3413b4a63d91c7198dfa6c27ab2637c415b36"
],
"index": "pypi",
"version": "==1.4.0"
},
"requests": {
"hashes": [
"sha256:502a824f31acdacb3a35b6690b5fbf0bc41d63a24a45c4004352b0242707598e",
@ -47,10 +61,10 @@
},
"urllib3": {
"hashes": [
"sha256:61bf29cada3fc2fbefad4fdf059ea4bd1b4a86d2b6d15e1c7c0b582b9752fe39",
"sha256:de9529817c93f27c8ccbfead6985011db27bd0ddfcdb2d86f3f663385c6a9c22"
"sha256:4c291ca23bbb55c76518905869ef34bdd5f0e46af7afe6861e8375643ffee1a0",
"sha256:9a247273df709c4fedb38c711e44292304f73f39ab01beda9f6b9fc375669ac3"
],
"version": "==1.24.1"
"version": "==1.24.2"
}
},
"develop": {}


+ 42
- 23
README.md View File

@ -1,56 +1,75 @@
# charging stations
# london charging stations
at fosdem 2019 talks on [linking wikidata and osm](https://fosdem.org/2019/schedule/event/geo_osmwikidata/) and using [thousands of taxi gps traces to improve osm](https://fosdem.org/2019/schedule/event/geo_gpxtraces/) gave rise to an idea to consider osm as a platform for syndicating batches of government open data
at fosdem 2019 talks on [linking wikidata and osm](https://fosdem.org/2019/schedule/event/geo_osmwikidata/) and using [thousands of taxi gps traces to improve osm](https://fosdem.org/2019/schedule/event/geo_gpxtraces/) gave rise to an idea to consider osm as a platform for syndicating government open data, the next step was to try and find a way to semi-automate bulk imports of open data with osm community backing
the gis team at london city hall are proving a re-usable procedure to release open data, licensed via the [open government licence](http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) and [compatible with the open database licence](https://wiki.openstreetmap.org/wiki/Import/ODbL_Compatibility)
the gis team at london city hall are working to establish a re-usable means of releasing open data to osm, licensed via the [open government licence](http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) and [compatible with the open database licence](https://wiki.openstreetmap.org/wiki/Import/ODbL_Compatibility)
### initial investigations
there were some initial queries to the [talk-gb-london group](https://lists.openstreetmap.org/pipermail/talk-gb-london/2019-March/thread.html) and the author of [osm.wikidata.link](https://osm.wikidata.link), a visit to the [london meetup](https://wiki.openstreetmap.org/wiki/London) and a visit from the [community interest company](https://osmuk.org/the-cic/)
there were some initial queries to the [talk-gb-london group](https://lists.openstreetmap.org/pipermail/talk-gb-london/2019-March/thread.html) and the author of [osm.wikidata.link](https://osm.wikidata.link), a visit to the [london meetup](https://wiki.openstreetmap.org/wiki/London) and a visit from the [community interest company](https://osmuk.org/the-cic/) - the initial support from osm has been exemplary
#### assistance to osm
we provided geocoded ofgem environmental performance certificate data of [1314 photo voltaic installations in london](https://v.gd/london_epc_photo_voltaics)
#### first try with id and maps.me
we also had a go at using [id the browser osm editor](https://overpass-turbo.eu/s/GVJ) and [a maps.me note](https://www.openstreetmap.org/node/6334516924) to handle a series of 18 newly installed drinking fountains individually, and received some guidance on the use of tags in changesets
to learn more about osm, we had a go at using [iD, the osm in-browser editor](https://overpass-turbo.eu/s/GVJ) and [a maps.me note](https://www.openstreetmap.org/node/6334516924) to map a series of 18 newly installed drinking fountains individually, and received some guidance on the use of tags in changesets
## current osm data
## current osm data on charging stations
https://overpass-turbo.eu/s/HKc
## details of how to maintain tags on charging stations
https://wiki.openstreetmap.org/wiki/Tag:amenity=charging_station
## gla held record
[openlayers preview](https://maps.london.gov.uk/geoserver/gis/wms?service=WMS&version=1.1.0&request=GetMap&layers=gis%3Aenv_aqmap_rapidchargepoints&bbox=-0.49845770990034466%2C51.29667980345268%2C0.2505595121779243%2C51.68268223925517&width=768&height=395&srs=EPSG%3A4326&format=application/openlayers)
[openlayers 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)
## using osm conflate
command to use: `conflate -o results.osm -c preview.json -i charging-stations.py`
### installing dependencies and running charging-stations.py
dependencies - `osm_conflate` for running checks against osm, and `requests` for getting gla data from geoserver - are managed with [Pipenv](https://pipenv.readthedocs.io) but could be done with pip and `requirements.txt`, which may be more portable to some environments
```sh
pipenv install
pipenv shell
conflate --changes preview.json --output results.osm charging-stations.py
```
...or
```sh
pipenv install
pipenv run conflate --changes preview.json --output results.osm charging-stations.py
```
_note on the flags used above_
```sh
conflate --help
-c CHANGES, --changes CHANGES
Write changes as GeoJSON for visualization
-o OUTPUT, --output OUTPUT
Output OSM XML file name
```
### main details on installation and use
https://wiki.openstreetmap.org/wiki/OSM_Conflator
### frontend
* http://audit.osmz.ru
* https://github.com/mapsme/cf_audit
#### workflow to semi automate data release
#### possible workflows
1. preview json, use josm `conflate -o results.osm -c preview.json -i charging-stations.py`
1. preview in [http://geojson.io/#id=gist:joelondon/c639a43732fe3f2fd6df5a0b72d9a884&map=10/51.5083/-0.1250](http://geojson.io/#id=gist:joelondon/c639a43732fe3f2fd6df5a0b72d9a884&map=10/51.5083/-0.1250)
2. upload with josm `conflate -o results.osm -c preview.json -i charging-stations.py`
2. audit preview json `conflate -o results.osm -c preview.json -i charging-stations.py`
1. upload to cf_audit
2. wait for community verification
3. download audit json
4. run through osm_conflate `conflate -o results-josm-ready.osm -a audit.json -i charging-stations.py`
the community part of the workflow is implemented in an additional project [osm-conflate-audit](https://maps.london.gov.uk/gitea/joelondon/osm-conflate-audit)
![conflation workflows](https://wiki.openstreetmap.org/w/images/f/fe/Conflate_audit_chart.jpg)
### example profile.py scripts in git repo
https://github.com/mapsme/osm_conflate/tree/master/profiles
### use of note tag
to show whether a station is restricted to taxis - it may be preferable not to map taxi only stations?
### unfinished locations
some charging stations in this dataset are not actually installed yet, and are listed without coordinates, these are filtered out in the profile
### mapping charging stations restricted to taxis
we received some guidance on [talk-gb-london](https://lists.openstreetmap.org/pipermail/talk-gb-london/2019-April/000184.html) on how to achieve this:
> For the stations that are restricted to taxis... would it be appropriate to use the access=* tag? It is mainly used for roads/paths and gates etc, but I think it is used in other cases to specify "who is allowed to use this feature".
> The [wiki page for access](https://wiki.openstreetmap.org/wiki/Key%3Aaccess) suggests that the way to do it would be the combination of `access=private` and `taxi=yes`

+ 15
- 10
charging-stations.py View File

@ -2,15 +2,13 @@
# https://wiki.openstreetmap.org/wiki/OSM_Conflator
# examples at https://github.com/mapsme/osm_conflate/tree/master/profiles
# command to use: conflate -o results.osm -c preview.json charging-stations.py
# 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%3Aenv_aqmap_rapidchargepoints&bbox=-0.49845770990034466%2C51.29667980345268%2C0.2505595121779243%2C51.68268223925517&width=768&height=395&srs=EPSG%3A4326&format=application/openlayers
# 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
# NOTE - this implementation uses the note tag to show whether a station is restricted to taxis
# it may be preferable not to map taxi only stations?
# some related tags to consider using
# some related tags for charging stations
# operator=*
# capacity=*
# ref=*
@ -26,7 +24,7 @@
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_rapid_charging_stations'
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
@ -47,8 +45,8 @@ def dataset(download_url):
service='WFS',
version='1.0.0',
request='GetFeature',
typeName='gis:env_aqmap_rapidchargepoints',
propertyName='(siteid,latitude,longtitude,taxipublicuses,numberrcpoints,sitename)(type)',
typeName='gis:london_charging_stations',
propertyName='(latitude,longtitude,taxipublicuses,numberrcpoints,sitename)(type)',
outputFormat='application/json',
maxFeatures=500
)
@ -56,21 +54,28 @@ def dataset(download_url):
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": 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

+ 576
- 576
preview.json
File diff suppressed because it is too large
View File


+ 2
- 0
requirements.txt View File

@ -0,0 +1,2 @@
requests
osm_conflate

+ 1
- 1
results.osm
File diff suppressed because it is too large
View File