111 | | * There is an import stylesheet for .osm files: static/xslt/import/osm.xsl |
112 | | * This currently has hard-coded mappings between OSM admin levels & Sahana admin levels |
113 | | * * http://wiki.openstreetmap.org/wiki/Tag:boundary%3Dadministrative#10_admin_level_values_for_specific_countries |
114 | | * A custom controller should be written |
115 | | * provide a UI to the user to select their country from the dropdown which pre-populates the mapping fields for manual verification/adjustment |
116 | | * process the results of this to pass new variables back to the stylesheet: |
117 | | * http://pub.nursix.org/eden/s3xrc/vita.modules.s3xrc.s3rest.S3Resource-class.html#import_xml |
118 | | {{{ |
119 | | resource = s3xrc.resource("gis", "location") |
120 | | template = os.path.join(request.folder, resource.XSLT_PATH, "osm", "import.xsl") |
121 | | resource.import_xml("uploaded_filename.osm", template=template, mynewvar="xxx") |
122 | | }}} |
123 | | * The Stylesheet needs updating to act on these vars when found |
125 | | A nice further refinement would be to provide a UI to select a BBOX & optional filter to pull down the .osm file via [http://wiki.openstreetmap.org/wiki/XAPI XAPI] |
126 | | * Initially this could be manual text box entry of BBOX/filter |
127 | | * Then add a Map-based BBOX selection & dropdowns for the filter (which prepopulate the real dropdowns for manual verification/amendment) |
| 112 | ==== Current Status ==== |
| 113 | * There is an import stylesheet for .osm files: static/xslt/import/osm.xsl |
| 114 | * This currently has hard-coded mappings between OSM admin levels & Sahana admin levels |
| 115 | * http://wiki.openstreetmap.org/wiki/Tag:boundary%3Dadministrative#10_admin_level_values_for_specific_countries |
| 116 | * There is an S3ImportPOI method to allow features to be extracted from either an uploaded .osm file or an OSM mirror: |
| 117 | * https://github.com/flavour/eden/blob/master/modules/s3/s3gis.py#L7938 |
| 118 | * this is accessed from the 'Import from OpenStreetMap menu option in /eden/gis |
| 120 | ==== Enhancements Needed ==== |
| 121 | * We need to add the Sahana UUID to these features in the OSM database. |
| 122 | * This is needed so that we can do deduplication on subsequent imports (the OSM ID is insufficient for this as it can change over time) |
| 123 | * This means we need to read the OSM credentials (currently a deployment_setting in 000_config.py but should be made per-user) & do a REST API call to the main OSM database with the modified feature(s) |
| 124 | * We would like to be able to control which features are imported from this UI (currently this is a deployment_setting in [000_]config.py - that should become the list of avaialble options rather than the absolute list) |
| 125 | * We would like to be able to download features for a Location from main OSM database |
| 126 | * We want to use the Polygon (falling-back to BBOX (min_lat, max_lon, etc)) to trigger a download of a suitably-filtered .osm file via the [http://wiki.openstreetmap.org/wiki/Overpass_API Overpass API] |
| 127 | * We would like to be able to download features for a Polygon |
| 128 | * Provide a map window with a Polygon selector tool which then triggers a download of a suitably-filtered .osm file via the [http://wiki.openstreetmap.org/wiki/Overpass_API Overpass API] |