= Feature Layers = * A 'Feature' is a Resource Record which has a Lat/Lon available. * ~~If a Lat/Lon is not directly attached to a Location, then it can be displayed on the Map by using the lowest-level of coordinates that are available within the hierarchy~~ * ~~Features can be Points, Lines or Polygons~~ * ~~Features can be added to the Map~~ * A Feature Layer is a collection of Features for displaying on the Map or for exporting as a feed * Resource * Filtered * Resource.Category (Report/Incident table, Missing Persons, L0->L3 in gis_location table) * Collection of Resources <- is this required? * feature_layer can have a query on new gis_landmark table which pulls in categories Port/Airport/Railway * Features can be removed from the map or moved on the map interactively. * To do this via a single set of Controls means having a single Vector Layer (or having to manually select the active layer!). * Build up this Vector Layer from multiple Feature Layers * In order to be able to dynamically enable/disable individual Feature Layers whilst viewing the map, we need to write a custom layer switcher which refreshes the whole Features Layer client-side upon changes. * Feature Layers can be filtered interactively without a server-side call to rebuild the map. * Need the original Feature_Layer to contain the attribute which we want to be able to filter on. Can then use our custom layer Switcher to apply the Filter. * Alternatively, (re)build the Feature Layers via AJAX calls when filters are changed. * Feature Layers can be refreshed to reflect new DB content without a server-side call to rebuild the map. * rebuild the Feature Layers via AJAX calls when refresh required (either button or timer for a big window) * ~~User can define which layers should be selectable/enabled-by-default in the Situation Mapping layer switcher.~~ * This list is personalisable. * move from layer definitions to gis_config * Have 1->M for Feature_Layers for available. * Attribute of visible stored in a separate multiple field. * Combine with special widget? * ~~Features can be exported in KML/GeoRSS/GPX/etc~~ * Need to update S3XRC for GPS symbol detection when !FeatureClass allocation changes * Need to update gis.get_marker() when !FeatureClass allocation changes == Markers == A Marker is an image used to represent a Feature on the map. The Marker used will be: 1. ~~Cluster marker if multiple markers close together~~ * ~~styled by size & include the # inside (when >2)~~ * prevents performance issues as well as making things clearer 2. ~~The Feature marker (if defined)~~ * Q: Is this required? * Removing it will make for a more consistent User Interface as the symbology can be trusted * Removing it will speed things up the operation of gis.get_marker() * Q: If kept, should we provide an option to allow the !FeatureClass icon to over-ride individual Feature Icons? 3. ~~Styling based on values of an attribute of the resource~~ * Need to be able to store these definitions within the !FeatureLayer so that they are available not just to specific modules but also to the main Situation Mapping * Want UI to be able to choose the attribute, the values & the markers 4. ~~The !FeatureClass marker (if defined)~~ * This should be selected accroding to the currently active [http://wiki.gis.com/wiki/index.php/Symbology Symbology] 5. ~~The Default marker~~ A legend should be added to the Layer Switcher to show which layer relates to which icon. [wiki:BluePrintGISMarkers Markers BluePrint] == Popups == ~~Clicking a Feature should bring up a Popup~~ * ~~This can be a URL to load (flexible, but slow)~~ * define the URL in !FeatureClass? !FeatureGroup? * Future: allow inserting a per-feature popup_url into the query before passing into API, e.g. {{{ features_query = db(query).select() for feature in features_query: feature.popup_url = URL(r=request, c="vol", f="vol") + "%(location_id)s" }}} * Support string substitution like %(location_id)s * the onFeatureSelect control is per-layer not per-feature & so feature-specific aspects need to be evaluated client-side in Javascript. * If not provided, the default is: * Loaded into the map during main load: no server-side calls * Header should be found from a set of common options (name/code) * How to do this with JOINed queries? * All the list_fields with their labels * A link to open the record in a new tab ~~Clicking a Cluster should bring up a Popup~~ * ~~a list of the features within the cluster~~ * ~~each list item is hyperlinked to bring up the Feature's Popup~~ * ~~Option to Zoom In~~ Q: Provide option to add Labels to Features? * http://gis.ibbeck.de/ginfo/apps/OLExamples/OL26/examples/labels.html * NB We already have OnHover popups (although they could use delaying) == Implementation == === Option A (preferred) === Hardcode the link between !FeatureClass & Resource (with optional category, e.g. for 'Report/Incident' table) * Add optional category_field/category_value columns to the feature_class table * If wanting feature-specific markers then add marker_id to resource tables (by bundling with location_id) * Replace feature_group table with feature_layer table * fields: * name * resource (used to populate the query field via an 'onvalidation') * filter_field (optional. used to populate the query field via an 'onvalidation') * filter_value (optional. used to populate the query field via an 'onvalidation') * query (hidden behind 'Advanced' button?) * marker_id (optional: over-ride all markers for this query) * comments === Option B === !FeatureClass is an attribute of the link table * location_id extended to include feature_class_id (& marker_id) fields * => a Feature Group cannot be a collection of Feature Classes since we can't trawl through all resources to see if any of them have been tagged for this FC == Storage == [wiki:BluePrintGISStorage] == Docs == * http://docs.openlayers.org/library/overlays * http://dev.openlayers.org/docs/files/OpenLayers/Feature/Vector-js.html * http://dev.openlayers.org/docs/files/OpenLayers/Layer/Vector-js.html === Examples === * Use HTTP to pull down Features List as XML: http://openlayers.org/dev/examples/behavior-fixed-http-gml.html * Controls to Add/Drag Features: http://openlayers.org/dev/examples/drag-feature.html * Select Feature (inc via Box): http://www.openlayers.org/dev/examples/select-feature.html * Popup on Feature: http://www.openlayers.org/dev/examples/select-feature-openpopup.html * Style Features: * http://www.openlayers.org/dev/examples/styles-context.html * http://www.openlayers.org/dev/examples/styles-unique.html * http://www.openlayers.org/dev/examples/sundials.html * Download/Upload serialized feature data: http://www.openlayers.org/dev/examples/vector-formats.html * Cluster Strategy: http://www.openlayers.org/dev/examples/strategy-cluster.html === Limitations === * http://faq.openlayers.org/vector-related-questions/ === Implementation Notes === The Draft features layer (draftLayer) is not in featureLayers (& hence not in allLayers) * This was done to stop the highlightControl being active (although that could have been done through an exception into tooltipSelect()) * This potentially means we can have the separate selectControl() * What do we gain from being in allLayers? * shared Toggle for popups * What do we gain from being in featureLayers? * Potential shared clustering? ---- [wiki:BluePrintGeographicInformationSystems GIS BluePrints] [wiki:BluePrintGeographicInformationSystems GIS BluePrints]