Version 23 (modified by 14 years ago) ( diff ) | ,
---|
Table of Contents
Locations Hierarchy
Provide a flexible Locations Hierarchy.
These are the 'Admin Boundaries': L0 - L4
Adding of locations within the L0-L4 range should normally be done by the Administrator prior to going live with the deployment so that these can then be locked-down to the MapAdmin role to prevent duplicate name entries.
Default names (customisable in models/000_config.py
):
deployment_settings.gis.locations_hierarchy = { "L0":T("Country"), "L1":T("Province"), "L2":T("District"), "L3":T("Town"), "L4":T("Village") }
Since most deployments are restricted to just 1 or few countries, it is possible to hard-code which ones are used (in models/000_config.py
):
deployment_settings.L10n.countries = ["PK"]
Location Selector
Status: PakistanDevelopers#LocationsSelector
There are 6 ways of adding a location, listed in ideal order:
- Bulk import has either Location Names or Lat/Lons
- This could optionally use Image EXIF headers or a timesynced GPX file
- NB: This refinement can be added later
- HTML5 GeoLocation: If the resource is one where the user is likely to be physically at the relevant location
- e.g. pr/person/presence can be recorded automatically upon login
- We should use a 'nearby' algorithm (like
gis.get_features_in_radius()
) to re-use existing locations rather than adding a new one each time. - NB: This refinement can be added later
- Map: User clicks on a location on the map
- If we have admin boundaries available then:
- We can zoom to the correct area if a level of hierarchy has been selected
- The correct hierarchy can be filled-in automatically
- If not then the user can be prompted to provide these (as per 6)
- Michael: It would also be useful if existing locations could be displayed on the map (prehaps with the Location Type displayed too), so that the user could add a new location relative to existing locations, or choose a existing location off the map instead.
- Manual Entry of Lat/Lon: (either from a GPS or looked up in an online resource like Wikipedia)
- A Conversion tool is available to convert from Deg/Min/Sec to Decimal Degrees
- If we have admin boundaries available then the correct hierarchy can be filled-in automatically
- If not then the user can be prompted to provide these (as per 6)
- Geocoder: Street Address is entered & this is matched to a location via a Geocoding service
- We already have functionality ready for Google & Yahoo in
modules/s3gis.py
. - We need to add at least Geonames.
- Hierarchical Selector:
- We have dropdowns for each of the different levels.
- The country selector should remain hidden if there is only 1 country being used.
- Initially just a single dropdown should be displayed.
- When this dropdown is selected then the next dropdown is displayed, along with appropriate values
- We download the values via AJAX in order to not have to download all Locations, however we could download the next set in the background whilst the user is thinking: means a bigger download to filter client-side, but maybe less time overall. Can be experimented with.
- When the final dropdown is selected then the user has the option of adding a more specific Name & a Street Address
- This should not be mandatory as some records need to link directly to the L0-L4 levels.
If adding a new Location, then the name of the location should *not* be the general name, but rather a specific one
- Where possible, we automate this by using the name of the Shelter or Hospital
- Should we prevent 'Add Location' from working until that field is filled-in?
- We need to make this clear in the online help.
We want to be able to optionally specify which levels of hierarchy we are interested in for this resource. This would be part of the API for location_id()
Known Issues
Duplication of location records
This happens when you for example create a new hospital record without creating a new location, but just selecting one (just select a country, for example). When you submit, then a new location record is created with the same name as the selected one - this seems wrong. You can make it visible by uncommenting the show_status line. The reason for this behaviour is that S3.gis.uuid is empty in case there is no old_location, which triggers the creation of a new record. Thus, this does not happen in update, and not either when you create a new location (which creates a new location anyway :D).
Use in Component Forms
To be able to apply the location selector to components (e.g. person/presence, where it would be *very* useful), we need to go away from the 'request.controller+"_"+request_function' construction and instead use jr.
Perhaps this way:
{{try:}} var location_id = '{{=jr.prefix+"_"+jr.target()[1]+ "_location_id"}}'; {{except:}} var location_id = '{{=request.controller+"_"+request.function+ "_location_id"}}'; {{pass}}
Hierarchy Tree
Have a HTML component that allows the user to explore the locations as a Tree:
+ Province 1 - Province 2 |_+ District 1 |_- District 2 | |_ + Village 1 | |_ + Village 2 | |_+ District 3 + Province 3 + Province 4 |_+ District 4 |_+ District 5
This could be used to:
- Create search criteria (have check boxes by each location name, to include that location, and all sublocations, in the search).
- Allow to user to navigate to a location and then open it to see the different resources associated with it.
- Zoom to the location on the map.
- Simply allow the user to see what lcoations have been entered in the database.
Agasti
Sahana Phase2 has a nice hierarchical Locations system:
This is useful for categorising data for Reporting purposes.
It doesn't have any link to GIS though....we need to be able to link the Locations to GIS polygons.
The definition of Locations can be different in different sectors (not just the names of the locations, but also their actual boundaries)
e.g.:
- category = "Health" would have types = National, Regional, Provincial, District, MOH Divisions, PHI areas, etc
- category = "Governance" would have types = National, Provincial (or state), District, Division, Tribunal (or Gramasevaka area)