Changes between Version 19 and Version 20 of DeveloperGuidelines/GIS


Ignore:
Timestamp:
07/10/10 19:25:37 (15 years ago)
Author:
Fran Boon
Comment:

Mapping API is live

Legend:

Unmodified
Added
Removed
Modified
  • DeveloperGuidelines/GIS

    v19 v20  
    44
    55== Guidelines for Developers wishing to make use of Mapping within their Module ==
    6 We are about to develop a Mapping API to make this easy.
    7  * [wiki:BluePrintGISAPI]
    8 Until then, to understand how mapping works, see:
    9  * [wiki:UserGuidelinesGIS]
    10  * [wiki:BluePrintGISFeatureLayers]
    11 
    12 
     6The easiest approach is to call the Mapping API.
     7=== Controller ===
     8{{{
     9map = gis.show_map()
     10return dict(map=map)
     11}}}
     12=== View ===
     13{{{
     14{{=XML(map)}}
     15}}}
     16=== Examples ===
     17Check the following functions in {{{controllers/gis.py}}}:
     18 * {{{map_viewing_client()}}}
     19 * {{{display_feature()}}}
     20 * {{{display_features()}}}
     21
     22=== Full API description ===
     23{{{
     24def show_map( self,
     25              height = None,
     26              width = None,
     27              bbox = {},
     28              lat = None,
     29              lon = None,
     30              zoom = None,
     31              projection = None,
     32              features = {},
     33              feature_overlays = [],
     34              wms_browser = {},
     35              catalogue_overlays = False,
     36              catalogue_toolbar = False,
     37              legend = False,
     38              toolbar = False,
     39              search = False,
     40              print_tool = {},
     41              mgrs = {},
     42              window = False,
     43              collapsed = False,
     44              public_url = "http://127.0.0.1:8000"
     45            ):
     46    """
     47    @param height: Height of viewport (if not provided then the default setting from the Map Service Catalogue is used)
     48    @param width: Width of viewport (if not provided then the default setting from the Map Service Catalogue is used)
     49    @param bbox: default Bounding Box of viewport (if not provided then the Lat/Lon/Zoom are used) (Dict):
     50        {
     51        "max_lat" : float,
     52        "max_lon" : float,
     53        "min_lat" : float,
     54        "min_lon" : float
     55        }
     56    @param lat: default Latitude of viewport (if not provided then the default setting from the Map Service Catalogue is used)
     57    @param lon: default Longitude of viewport (if not provided then the default setting from the Map Service Catalogue is used)
     58    @param zoom: default Zoom level of viewport (if not provided then the default setting from the Map Service Catalogue is used)
     59    @param projection: EPSG code for the Projection to use (if not provided then the default setting from the Map Service Catalogue is used)
     60    @param features: A Query of Features to overlay onto the map & their options (Dict):
     61        {
     62         name   : "Query",      # A string: the label for the layer
     63         query  : query,        # A gluon.sql.Rows of gis_locations
     64         active : False,        # Is the feed displayed upon load or needs ticking to load afterwards?
     65         popup_url : None,      # The URL which will be used to fill the pop-up. it will be appended by the Location ID.
     66         marker : None          # The icon used to display the feature (over-riding the normal process). Can be a lambda to vary icon (size/colour) based on attribute levels.
     67        }
     68    @param feature_overlays: Which Feature Groups to overlay onto the map & their options (List of Dicts):
     69        [{
     70         feature_group : db.gis_feature_group.name,
     71         parent : None,         # Only display features with this parent set. ToDo: search recursively to allow all descendants
     72         filter : None,         # A query to further limit which features from the feature group are loaded
     73         active : False,        # Is the feed displayed upon load or needs ticking to load afterwards?
     74         popup_url : None,      # The URL which will be used to fill the pop-up. it will be appended by the Location ID.
     75         marker : None          # The icon used to display the feature (over-riding the normal process). Can be a lambda to vary icon (size/colour) based on attribute levels.
     76        }]
     77    @param wms_browser: WMS Server's GetCapabilities & options (dict)
     78        {
     79        name: string,           # Name for the Folder in LayerTree
     80        url: string             # URL of GetCapabilities
     81        }
     82    @param catalogue_overlays: Show the Overlays from the GIS Catalogue (@ToDo: make this a dict of which external overlays to allow)
     83    @param catalogue_toolbar: Show the Catalogue Toolbar
     84    @param legend: Show the Legend panel
     85    @param toolbar: Show the Icon Toolbar of Controls
     86    @param search: Show the Geonames search box
     87    @param print_tool: Show a print utility (NB This requires server-side support: http://eden.sahanafoundation.org/wiki/BluePrintGISPrinting)
     88        {
     89        url: string,            # URL of print service (e.g. http://localhost:8080/geoserver/pdf/)
     90        mapTitle: string        # Title for the Printed Map (optional)
     91        subTitle: string        # subTitle for the Printed Map (optional)
     92        }
     93    @param mgrs: Use the MGRS Control to select PDFs
     94        {
     95        name: string,           # Name for the Control
     96        url: string             # URL of PDF server
     97        }
     98    @param window: Have viewport pop out of page into a resizable window
     99    @param collapsed: Start the Tools panel (West region) collapsed
     100    @param public_url: pass from model (not yet defined when Module instantiated
     101    """
     102}}}
    13103== Guidelines for Developers wishing to extend the functionality of the core GIS ==
    14104=== !OpenLayers ===