Haiti GIS
bitner, gavin_t, flavour & tcarobruce coordinating in #sahana-gis
dokotreas & runneals joined the team
Bugs
Documentation
The focus should be on concepts & Helpfile tweaks rather than detailed UI paths, as the UI is not final.
Map-based Lat/Lon Data entry
- Provide a function to allow selecting a location on a map to populate
- Points: Lat/Lon fields
- Polygons: WKT
Fix the map-based gis_location.represent
Currently this is commented out in models/03_gis.py
Want to separate out HTML representation .represent's from Export ones (i.e. all the rest).
- Plan for this in-progress
Location Entry
- Record source and associated error (related so posted under a single trac ticket #158
- Ability to record Location Data Source for all locations (GPS, Imagery Analysis, etc.)
- Ability to record location estimated accuracy (meters)
- GPS Conversion Tool
- Accessible from /gis/location/create
- Should support negative degrees!
- Ideally should allow setting of N/S & E/W instead of having to remember the +/-
UI
- Separate out the Internal Features from External Features in LayerSwitcher (GeoExt skills)
views/gis/map_viewing_client.html
+68
- Be able to Group layers in layer Tree into Folders
- Provide Ext sliders to control cluster_distance & cluster_threshold interactively
Add numZoomLevels=22 (or some higher number than the default 16 so can zoom in on high res imagery better
Admin UI
- Provide admin UI for feature_to_feature_group, feature_class_to_feature_group, etc
controllers/gis.py
&views/gis/...
- Features are stored in the table gis_location
- Feature Classes are types of Feature & determine their Marker (Icon): gis_feature_class
- Feature Groups are collections of Features & Feature Groups & determine whether they appear as a separate layer on the Map to be enabled/disabled: gis_feature_group
- There are Many-to-Many tables linking these together (defined in
models/03_gis.py
) - There are basic Controller functions for editing these resources, however they aren't fully-exposed to users (need to type URL manually)
- We want nice User interface for these & menus (menus for GIS need some wider cleanup work anyway)
- 'mapping' table for feature classes - mapping web markers
- Allow to reorder layers and select which base layer to start with
- Explanatory text with the Views
Feeds
- Provide a feed for:
- http://haiti.sahanafoundation.org/prod/gis/location.kml?feature_group=Port-au-Prince
- Need to work on
controllers/gis.py +260
- Provide UI to access feeds:
- KML feeds:
- http://haiti.sahanafoundation.org/prod/gis/location.kml
- http://haiti.sahanafoundation.org/prod/gis/location.kml?feature_class=Hospital
- http://haiti.sahanafoundation.org/prod/or/organisation/4/office.kml
- Provide an easy way to select the Org by name
- http://haiti.sahanafoundation.org/prod/or/office.kml
- GeoRSS feeds:
- GPX feeds:
- KML feeds:
- KML Export
- http://code.google.com/apis/kml/documentation/kmlreference.html
- Include Marker
From our own site when using Portal- From sahanafoundation.org when using an offline instance?
- So have a setting flag in
models/00_settings.py
for this (or gis_config table or gis_settings table?)
- So have a setting flag in
- Bundled as KMZ: http://code.google.com/apis/kml/documentation/kmzarchives.html
- bounds information - e.g. lat/lon min/max to go in the metadata. this improves display of KML when opened in the like of GE and other apps. not required, but does improve display
- Polygon support (currently uses Centroid)
- GeoRSS Export
- Polygon support (currently uses Centroid)
- GPX Export
- classify types when exported to Garmin icons (e.g. hms_hospital->Medical Facility, or_office->Building) See ref1,ref2. Note, recommended to use <sym>text</sym to identify and not number. Enhancement tickets to better support this 159, 160
- stick some extra info into <desc> - as auto GPS units what support bluetooth phones can recognise phone numbers and allow hands free calling
bounds information - e.g. lat/lon min/max to go in the metadata. this improves display of GPX when opened in the like of GE and other apps. not required, but does improve display- Polygon support (currently uses Centroid)
- Import
- GPX
- Bulk Uploader needs finishing
- Possibly add a feature that recognizes symbols for waypoints
- GeoRSS
- KML
- GPX
- Provide a DB field for OSM ID, and provide a link in KML fields to set/update this ID:
<crschmidt> Is there a way we can add a 'entered into osm' field in sahana that OSMers can edit as they add things to their map? <nursix> I think that should go into the location table, not into the hospital table <nursix> I can then export <nursix> And put into the KML feed
Code Cleanup
Move GIS functions to a newmodules/s3gis.py
DRY the gis_config parsing incontrollers/gis.py
(currently in 3 different places!)- pass a single s3.gis var through to views
Hierarchical Trees
We currently use a simple Adjacency List model for gis_location (i.e. a single 'parent' field).
This is fast for writes, but slow for reads, which is not the ideal optimisation for our use case.
We should move to one of these models:
- Materialised Path: http://docs.tabo.pe/django-treebeard/tip/#module-treebeard.mp_tree
- Nested Sets: http://docs.tabo.pe/django-treebeard/tip/#module-treebeard.ns_tree
- Modified Preorder Tree Traversal:
- http://groups.google.com/group/web2py/browse_thread/thread/d1e1ca4eb75174ac
See the gis_location model in models/03_gis.py
See get_children() & update_location_tree() in modules/s3gis.py
IS_LOCATION Validator
Add a custom validator to modules/s3/s3validators.py
:
IS_LOCATION()
- This should support the ability to select a gis_location as an admin area (i.e. we don't know the exact location, but we know the town or district)
- This should be an AJAX auto-complete.
- Once chosen, then the 'parent' will be set to this location
- It should also support the ability to enter a precise Lat/Lon (or Polygon), in which case a function in the new
modules/s3gis.py
would calculate which admin area to set as the Parent automatically.
- It should also populate the 4 hidden (readable=writable=False) bounding box fields used to speed up spatial queries
OpenLayers
- Features Layers
- Replace the custom function with accessing the internal KML feeds as then we get the ability to add useful info to popups via XSLT for both internal & external use
- WFS Layers
- WMS Capabilities Browser
- Unzip KMZ layers
XYZ Layers- Generated JS seems OK, but layers aren't visible
- XYZ layers verbatim from http://hypercube.telascience.org/haiti/uav.html work when entered as advanced JS layers
- Image layers?
- Added image layers from http://hypercube.telascience.org/haiti/uav.html using advanced JS
Cluster Strategy
MGRS
Done
Add MGRS Coordinate Display to MapChris Schmidt made MGRS / Lat Lon mouse position control using Jim Klassens USNG Libmap.addControl(new OpenLayers.Control.MGRSMousePosition());Example Code http://hypercube.telascience.org/haiti/js/haiti.jsUsing http://hypercube.telascience.org/haiti/js/usng2.jsAnd http://hypercube.telascience.org/haiti/js/MP.js
Add Clickable Index (KML, GeoRSS, or Queryable WMS) to get to MGRS Map Sheets begin Produced by Talbot BrooksRequires BluePrintGISProxy
ToDo
- Bug: Control is being activated when clicking on KML/GeoRSS popups!
- Beyond Haiti: Only activate control if bounds correct (-80 < Lat < 80?)
- A toolbar icon would be nice (Grid?)
- Move from Layers to a new 'Controls' section
Load GIS data
tcarobruce working on this with jonathank & mettadore
http://drop.io/sahanahaitigis - I have posted files here with data information http://virtualdisasterviewer.com/haitiGrids/information/
CHECK OUT:
- http://www.virtualdisasterviewer.com/vdv/index.php?selectedEventId=7
- Street View! http://www.immersivemedia.com/haiti/index.php
ToDo
- admin_area_for_latlng
- filter by bbox (once implemented)
- then use shapely to do Point-in-Polygon on remaining geometries
- merge wkt parse code into
modules/s3gis.py
- simplify polygon if too big for wkt field (or throw exception, to start)
- code in
modules/s3gis.py
- code in
- don't display all admin area feature groups (> 700)
enabled = False
Administrative Areas
- Sources
- Unofficial: Departments, Communes, Sections in EPSG:4326
- Official (from GeoInt-Online): Departments, Communes, Sections
- Projection Issue Departments and Communes files are in EPSG:32618
- WMS for display on Map (large Vectors will slow browsers to a crawl): http://haiti.opensgi.net/geoserver/ows?service=wms&version=1.1.1&request=GetCapabilities
- Preprocessing Addendum
- Shapefile to WKT (for calculations):
ogr2ogr -f CSV haiti_departments Haiti_departementes_edited_01132010.shp -lco GEOMETRY=AS_WKT
(OGR 1.6+)- to reproject with ogr2ogr, add source and transformation SRSes:
-s_srs EPSG:32618 -t_srs EPSG:4326
- Build a script to do this (very useful for future responses as this is a common process)
- can run the script from a Controller so that you can access Models
- provide UI afterwards
- to reproject with ogr2ogr, add source and transformation SRSes:
- Shapefile to WKT (for calculations):
Other Data To Load
- 'L4' Streets (just POINTs): http://wiki.openstreetmap.org/wiki/WikiProject_Haiti/Street_names/All_Streets
- Populations
- TMS/WMS layers for new imagery:
- http://www.geonames.org/search.html?q=&country=HT
- http://www.fallingrain.com/world/HA/
- Populate Elevation Data from SRTMs
- callback from s3gis to vcheck if we have data/can download it
Longer Term Improvements
- use a spatial db like PostGIS
- bulk loading via web interface
- use location's
admin_id
to give users (presumably local experts) administrative control over locations in a particular geographic area