| 42 | | === Proposed API === |
| 43 | | Status: |
| 44 | | * Live: [wiki:DeveloperGuidelinesGIS#GuidelinesforDeveloperswishingtomakeuseofMappingwithintheirModule] |
| 45 | | |
| 46 | | ==== Embed a map within a Page ==== |
| 47 | | {{{ |
| 48 | | def show_map( self, |
| 49 | | height = None, |
| 50 | | width = None, |
| 51 | | lat = None, |
| 52 | | lon = None, |
| 53 | | zoom = None, |
| 54 | | projection = None, |
| 55 | | feature_overlays = [], |
| 56 | | wms_browser = {}, |
| 57 | | catalogue_overlays = False, |
| 58 | | catalogue_toolbar = False, |
| 59 | | toolbar = False, |
| 60 | | search = False, |
| 61 | | print_tool = {}, |
| 62 | | mgrs = {}, |
| 63 | | window = False, |
| 64 | | public_url = "http://127.0.0.1:8000" |
| 65 | | ): |
| 66 | | """ |
| 67 | | Returns the HTML to display a map |
| 68 | | |
| 69 | | @param height: Height of viewport (if not provided then the default setting from the Map Service Catalogue is used) |
| 70 | | @param width: Width of viewport (if not provided then the default setting from the Map Service Catalogue is used) |
| 71 | | @param lat: default Latitude of viewport (if not provided then the default setting from the Map Service Catalogue is used) |
| 72 | | @param lon: default Longitude of viewport (if not provided then the default setting from the Map Service Catalogue is used) |
| 73 | | @param zoom: default Zoom level of viewport (if not provided then the default setting from the Map Service Catalogue is used) |
| 74 | | @param projection: EPSG code for the Projection to use (if not provided then the default setting from the Map Service Catalogue is used) |
| 75 | | @param feature_overlays: Which Feature Groups to overlay onto the map & their options (List of Dicts): |
| 76 | | [{ |
| 77 | | feature_group : db.gis_feature_group.name, |
| 78 | | parent : None, # Only display features with this parent set. ToDo: search recursively to allow all descendants |
| 79 | | filter : None, # A query to further limit which features from the feature group are loaded |
| 80 | | active : False, # Is the feed displayed upon load or needs ticking to load afterwards? |
| 81 | | popup_url : None, # The URL which will be used to fill the pop-up. it will be appended by the Location ID. |
| 82 | | 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. |
| 83 | | }] |
| 84 | | @param wms_browser: WMS Server's GetCapabilities & options (dict) |
| 85 | | { |
| 86 | | name: string, # Name for the Folder in LayerTree |
| 87 | | url: string # URL of GetCapabilities |
| 88 | | } |
| 89 | | @param catalogue_overlays: Show the Overlays from the GIS Catalogue (@ToDo: make this a dict of which external overlays to allow) |
| 90 | | @param catalogue_toolbar: Show the Catalogue Toolbar |
| 91 | | @param toolbar: Show the Icon Toolbar of Controls |
| 92 | | @param search: Show the Geonames search box |
| 93 | | @param print_tool: Show a print utility (NB This requires server-side support: http://eden.sahanafoundation.org/wiki/BluePrintGISPrinting) |
| 94 | | { |
| 95 | | url: string # URL of print service (e.g. http://localhost:8080/geoserver/pdf/) |
| 96 | | } |
| 97 | | @param mgrs: Use the MGRS Control to select PDFs |
| 98 | | { |
| 99 | | name: string, # Name for the Control |
| 100 | | url: string # URL of PDF server |
| 101 | | } |
| 102 | | @param window: Have viewport pop out of page into a resizable window |
| 103 | | @param public_url: pass from model (not yet defined when Module instantiated |
| 104 | | |
| 105 | | @ToDo: Rewrite these to use the API: |
| 106 | | map_viewing_client() |
| 107 | | display_feature() |
| 108 | | display_features() |
| 109 | | """ |
| 110 | | }}} |
| 111 | | |
| 112 | | ==== Produce Custom Overlay ==== |
| | 49 | === Produce Custom Overlay === |