29 | | {{{ |
30 | | def show_map( self, |
31 | | id = "default_map", |
32 | | height = None, |
33 | | width = None, |
34 | | bbox = {}, |
35 | | lat = None, |
36 | | lon = None, |
37 | | zoom = None, |
38 | | projection = None, |
39 | | add_feature = False, |
40 | | add_feature_active = False, |
41 | | add_line = False, |
42 | | add_line_active = False, |
43 | | add_polygon = False, |
44 | | add_polygon_active = False, |
45 | | features = None, |
46 | | feature_queries = None, |
47 | | feature_resources = None, |
48 | | wms_browser = {}, |
49 | | catalogue_layers = False, |
50 | | legend = False, |
51 | | toolbar = False, |
52 | | area = False, |
53 | | nav = None, |
54 | | save = False, |
55 | | search = False, |
56 | | mouse_position = None, |
57 | | overview = None, |
58 | | permalink = None, |
59 | | scaleline = None, |
60 | | zoomcontrol = None, |
61 | | zoomWheelEnabled = True, |
62 | | mgrs = {}, |
63 | | window = False, |
64 | | window_hide = False, |
65 | | closable = True, |
66 | | maximizable = True, |
67 | | collapsed = False, |
68 | | callback = "DEFAULT", |
69 | | plugins = None, |
70 | | ): |
71 | | """ |
72 | | Returns the HTML to display a map |
73 | | |
74 | | Normally called in the controller as: map = gis.show_map() |
75 | | In the view, put: {{=XML(map)}} |
76 | | |
77 | | @param id: ID to uniquely identify this map if there are several on a page |
78 | | @param height: Height of viewport (if not provided then the default deployment setting is used) |
79 | | @param width: Width of viewport (if not provided then the default deployment setting is used) |
80 | | @param bbox: default Bounding Box of viewport (if not provided then the Lat/Lon/Zoom are used) (Dict): |
81 | | {"lon_min" : float, |
82 | | "lat_min" : float, |
83 | | "lon_max" : float, |
84 | | "lat_max" : float, |
85 | | } |
86 | | @param lat: default Latitude of viewport (if not provided then the default setting from the Map Service Catalogue is used) |
87 | | @param lon: default Longitude of viewport (if not provided then the default setting from the Map Service Catalogue is used) |
88 | | @param zoom: default Zoom level of viewport (if not provided then the default setting from the Map Service Catalogue is used) |
89 | | @param projection: EPSG code for the Projection to use (if not provided then the default setting from the Map Service Catalogue is used) |
90 | | @param add_feature: Whether to include a DrawFeature control to allow adding a marker to the map |
91 | | @param add_feature_active: Whether the DrawFeature control should be active by default |
92 | | @param add_polygon: Whether to include a DrawFeature control to allow drawing a polygon over the map |
93 | | @param add_polygon_active: Whether the DrawFeature control should be active by default |
94 | | @param features: Simple Features to overlay on Map (no control over appearance & not interactive) |
95 | | [wkt] |
96 | | @param feature_queries: Feature Queries to overlay onto the map & their options (List of Dicts): |
97 | | [{"name" : T("MyLabel"), # A string: the label for the layer |
98 | | "query" : query, # A gluon.sql.Rows of gis_locations, which can be from a simple query or a Join. |
99 | | # Extra fields can be added for 'popup_url', 'popup_label' & either |
100 | | # 'marker' (url/height/width) or 'shape' (with optional 'colour' & 'size') |
101 | | "active" : True, # Is the feed displayed upon load or needs ticking to load afterwards? |
102 | | "marker" : None, # Optional: A per-Layer marker query or marker_id for the icon used to display the feature |
103 | | "opacity" : 1, # Optional |
104 | | "cluster_attribute", # Optional |
105 | | "cluster_distance", # Optional |
106 | | "cluster_threshold" # Optional |
107 | | }] |
108 | | @param feature_resources: REST URLs for (filtered) resources to overlay onto the map & their options (List of Dicts): |
109 | | [{"name" : T("MyLabel"), # A string: the label for the layer |
110 | | "id" : "search", # A string: the id for the layer (for manipulation by JavaScript) |
111 | | "active" : True, # Is the feed displayed upon load or needs ticking to load afterwards? |
112 | | EITHER: |
113 | | "layer_id" : 1, # An integer: the layer_id to load (optional alternative to specifying URL/tablename/marker) |
114 | | "filter" : "filter", # A string: an optional URL filter which *replaces* any in the layer |
115 | | OR: |
116 | | "tablename" : "module_resource", # A string: the tablename (used to determine whether to locate via location_id or site_id) |
117 | | "url" : "/eden/module/resource.geojson?filter", # A URL to load the resource |
118 | | |
119 | | "marker" : None, # Optional: A per-Layer marker dict for the icon used to display the feature (overrides layer_id if-set) |
120 | | "opacity" : 1, # Optional (overrides layer_id if-set) |
121 | | "cluster_attribute", # Optional (overrides layer_id if-set) |
122 | | "cluster_distance", # Optional (overrides layer_id if-set) |
123 | | "cluster_threshold", # Optional (overrides layer_id if-set) |
124 | | "dir", # Optional (overrides layer_id if-set) |
125 | | "style", # Optional (overrides layer_id if-set) |
126 | | }] |
127 | | @param wms_browser: WMS Server's GetCapabilities & options (dict) |
128 | | {"name": T("MyLabel"), # Name for the Folder in LayerTree |
129 | | "url": string # URL of GetCapabilities |
130 | | } |
131 | | @param catalogue_layers: Show all the enabled Layers from the GIS Catalogue |
132 | | Defaults to False: Just show the default Base layer |
133 | | @param legend: True: Show the GeoExt Legend panel, False: No Panel, "float": New floating Legend Panel |
134 | | @param toolbar: Show the Icon Toolbar of Controls |
135 | | @param area: Show the Area tool on the Toolbar |
136 | | @param nav: Show the Navigation controls on the Toolbar |
137 | | @param save: Show the Save tool on the Toolbar |
138 | | @param search: Show the Geonames search box (requires a username to be configured) |
139 | | @param mouse_position: Show the current coordinates in the bottom-right of the map. 3 Options: 'normal', 'mgrs', False (defaults to checking deployment_settings, which defaults to 'normal') |
140 | | @param overview: Show the Overview Map (defaults to checking deployment_settings, which defaults to True) |
141 | | @param permalink: Show the Permalink control (defaults to checking deployment_settings, which defaults to True) |
142 | | @param scaleline: Show the ScaleLine control (defaults to checking deployment_settings, which defaults to True) |
143 | | @param zoomcontrol: Show the Zoom control (defaults to checking deployment_settings, which defaults to True) |
144 | | @param mgrs: Use the MGRS Control to select PDFs |
145 | | {"name": string, # Name for the Control |
146 | | "url": string # URL of PDF server |
147 | | } |
148 | | @ToDo: Also add MGRS Search support: http://gxp.opengeo.org/master/examples/mgrs.html |
149 | | @param window: Have viewport pop out of page into a resizable window |
150 | | @param window_hide: Have the window hidden by default, ready to appear (e.g. on clicking a button) |
151 | | @param closable: In Window mode, whether the window is closable or not |
152 | | @param collapsed: Start the Tools panel (West region) collapsed |
153 | | @param callback: Code to run once the Map JavaScript has loaded |
154 | | @param plugins: an iterable of objects which support the following methods: |
155 | | .extend_gis_map(map) |
156 | | Client-side portion suppoprts the following methods: |
157 | | .addToMapWindow(items) |
158 | | .setup(map) |
159 | | """ |
160 | | }}} |
161 | | |
| 29 | Best to get live from the source: |
| 30 | * https://github.com/flavour/eden/blob/master/modules/s3/s3gis.py#L6014 |