46 | | gis.show_map( |
47 | | height = None, |
48 | | width = None, |
49 | | lat = None, |
50 | | lon = None, |
51 | | zoom = None, |
52 | | feature_overlays = {}, |
53 | | catalogue_overlays = False, |
54 | | catalogue_toolbar = False, |
55 | | toolbar = False, |
56 | | mgrs = False, |
57 | | window = False): |
58 | | """ |
59 | | height - int - height of map in pixels |
60 | | width - int - width of map in pixels |
61 | | lat - double - Initial map center point |
62 | | lon - double - Initial map center point |
63 | | zoom - int - the initial zoom level of the map |
64 | | feature_overlays - list of dictionaries: |
65 | | { |
66 | | feature_group: db.gis_feature_group.name, |
67 | | filter : None, # A query to limit which features from the feature group are loaded |
68 | | active : True, # Is the feed displayed upon load or needs ticking to load afterwards? |
69 | | popup_url : <default>, # The URL which will be used to fill the pop-up. it will be appended by the Location ID. |
70 | | marker : <default> # The icon used to display the feature. Can be a lambda to vary icon (size/colour) based on attribute levels. |
71 | | } |
72 | | catalogue_overlays - bool - whether or not to display the overlays enabled in the Map Service Catalogue |
73 | | [- list of ints - The external overlays (WMS/KML/GeoRSS/etc) to display on the map. Hard-coding this is Ugly! Can we not just make it Bool & use Map Service Catalogue for more control?] |
74 | | catalogue_toolbar - bool - whether or not to display the Map Service Catalogue toolbar |
75 | | toolbar - bool - whether or not to display the GeoExt toolbar |
76 | | mgrs - bool - whether or not to enable the MGRS PDF finder control |
77 | | window - bool - whether or not to have the map pop out into a resizable window |
78 | | base_layers - list of ints - base layers used for map. Hard-coding this is Ugly! Can we not just use Map Service Catalogue for this? Maybe creating separate configurations for separate use-cases, so can call e.g. db.gis_config.3 instead of the default |
79 | | internal_layertree - bool - whether or not to display the menu to turn on and off the internal_layers |
80 | | external_layertree - bool - whether or not to display the menu to turn on and off the external_layers |
| 46 | def show_map( self, |
| 47 | height = None, |
| 48 | width = None, |
| 49 | lat = None, |
| 50 | lon = None, |
| 51 | zoom = None, |
| 52 | projection = None, |
| 53 | feature_overlays = [], |
| 54 | wms_browser = {}, |
| 55 | catalogue_overlays = False, |
| 56 | catalogue_toolbar = False, |
| 57 | toolbar = False, |
| 58 | search = False, |
| 59 | print_tool = {}, |
| 60 | mgrs = {}, |
| 61 | window = False, |
| 62 | public_url = "http://127.0.0.1:8000" |
| 63 | ): |
| 64 | """ |
| 65 | Returns the HTML to display a map |
82 | | Will return the HTML to embed a map with the specified options. |
83 | | """ |
| 67 | @param height: Height of viewport (if not provided then the default setting from the Map Service Catalogue is used) |
| 68 | @param width: Width of viewport (if not provided then the default setting from the Map Service Catalogue is used) |
| 69 | @param lat: default Latitude of viewport (if not provided then the default setting from the Map Service Catalogue is used) |
| 70 | @param lon: default Longitude of viewport (if not provided then the default setting from the Map Service Catalogue is used) |
| 71 | @param zoom: default Zoom level of viewport (if not provided then the default setting from the Map Service Catalogue is used) |
| 72 | @param projection: EPSG code for the Projection to use (if not provided then the default setting from the Map Service Catalogue is used) |
| 73 | @param feature_overlays: Which Feature Groups to overlay onto the map & their options (List of Dicts): |
| 74 | [{ |
| 75 | feature_group : db.gis_feature_group.name, |
| 76 | parent : None, # Only display features with this parent set. ToDo: search recursively to allow all descendants |
| 77 | filter : None, # A query to further limit which features from the feature group are loaded |
| 78 | active : False, # Is the feed displayed upon load or needs ticking to load afterwards? |
| 79 | popup_url : None, # The URL which will be used to fill the pop-up. it will be appended by the Location ID. |
| 80 | 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. |
| 81 | }] |
| 82 | @param wms_browser: WMS Server's GetCapabilities & options (dict) |
| 83 | { |
| 84 | name: string, # Name for the Folder in LayerTree |
| 85 | url: string # URL of GetCapabilities |
| 86 | } |
| 87 | @param catalogue_overlays: Show the Overlays from the GIS Catalogue (@ToDo: make this a dict of which external overlays to allow) |
| 88 | @param catalogue_toolbar: Show the Catalogue Toolbar |
| 89 | @param toolbar: Show the Icon Toolbar of Controls |
| 90 | @param search: Show the Geonames search box |
| 91 | @param print_tool: Show a print utility (NB This requires server-side support: http://eden.sahanafoundation.org/wiki/BluePrintGISPrinting) |
| 92 | { |
| 93 | url: string # URL of print service (e.g. http://localhost:8080/geoserver/pdf/) |
| 94 | } |
| 95 | @param mgrs: Use the MGRS Control to select PDFs |
| 96 | { |
| 97 | name: string, # Name for the Control |
| 98 | url: string # URL of PDF server |
| 99 | } |
| 100 | @param window: Have viewport pop out of page into a resizable window |
| 101 | @param public_url: pass from model (not yet defined when Module instantiated |
| 102 | |
| 103 | @ToDo: Rewrite these to use the API: |
| 104 | map_viewing_client() |
| 105 | display_feature() |
| 106 | display_features() |
| 107 | """ |