@@ -121,7 +121,7 @@ The Firestations layer
121121
122122This section references the ``firestations `` source and
123123``fire_stations `` layer. For more information on setting those up in
124- your local demo, read the:doc: `. /add-a-layer `
124+ your local demo, read the :doc: `/howto/addlayer /add-a-layer `
125125guide.
126126
127127Adding identify to Firestations
@@ -165,3 +165,98 @@ Adding identify to Firestations
165165- This example uses GeoMoose's template system. GeoMoose has a rich
166166 template system provided by Mark.up. :ref: `More information on GeoMoose
167167 templates here. <templates>`
168+
169+ Adding identify to Raster Data
170+ -------------------------------
171+
172+ Identify can also be set up for raster data. For example, if you have DEM,
173+ you can set it up to allow users to identify elevation.
174+
175+ This example assumes you're connecting to a GeoTiff in a mapfile. Optionally,
176+ you can also connect via WMS, either in a mapfile, or in the ``mapbook.xml ``.
177+
178+ See below for an example configuration of the mapfile. Note that the
179+ ``TEMPLATE 'dummy' `` and the ``ows/gml_include_items 'all' `` lines are necessary
180+ for results to be returned. ``TOLERANCE 0 `` is also needed to prevent too
181+ many results from being returned.
182+
183+ ::
184+
185+ LAYER
186+ NAME "ExampleDEM"
187+ DATA "./pathToDEM.tif"
188+ STATUS ON
189+ TYPE RASTER
190+
191+ PROJECTION
192+ "init=epsg:3857"
193+ END
194+
195+ METADATA
196+ 'wms_title' 'Example_DEM'
197+ 'ows_include_items' 'all'
198+ 'gml_include_items' 'all'
199+ 'ows_exclude_items' 'SHAPE_area,SHAPE_len'
200+ 'gml_exclude_items' 'SHAPE_area,SHAPE_len'
201+ END
202+
203+ TOLERANCE 0
204+ TOLERANCEUNITS METERS
205+
206+ TEMPLATE 'dummy'
207+
208+ END
209+
210+ Once the mapfile is configured you can connect to the data in the ``mapbook.xml ``. Make sure
211+ to adjust the mapfile and layer names to match your mapfile. You will also need to change the
212+ field name value to match the value in your DEM. You can use ``template name="identify" auto="true"/> ``
213+ to automatically generate the template.
214+
215+ .. code :: xml
216+
217+ <map-source name =" DEM_Identify" type =" mapserver" >
218+ <file >./pathToDEMMapfile</file >
219+ <layer name =" ExampleDEM" status =" on" >
220+
221+ <template name =" identify" ><![CDATA[
222+ <div class="identify-result">
223+ <div class="item"><label>Elevation:</label>{{ properties.DEMFieldName|fix>1 }}</div>
224+ </div>
225+
226+ ]]> </template >
227+
228+ </layer >
229+
230+ <param name =" FORMAT" value =" image/png" />
231+ <param name =" TRANSPARENT" value =" TRUE" />
232+ <param name =" cross-origin" value =" anonymous" />
233+ </map-source >
234+
235+ Optionally, you can also connect to a WMS instead of a mapfile. The main things to
236+ be aware of when connecting via WMS are making sure that the WMS is configured to
237+ allow identify, and making sure that the WMS is configured to allow connections
238+ from other servers (i.e. Cross-origin-resource-sharing or CORS).
239+
240+ .. code :: xml
241+
242+ <map-source name =" DEM_Identify" type =" wms" >
243+ <url >https://location/of/DEM?</url >
244+ <layer name =" ExampleDEM" status =" on" >
245+
246+ <template name =" identify" ><![CDATA[
247+ <div class="identify-result">
248+ <div class="item"><label>Elevation:</label>{{ properties.item name=value_0|fix>1 }}</div>
249+ </div>
250+
251+ ]]> </template >
252+
253+ </layer >
254+
255+ <param name =" FORMAT" value =" image/png" />
256+ <param name =" TRANSPARENT" value =" TRUE" />
257+ <param name =" cross-origin" value =" anonymous" />
258+ </map-source >
259+
260+
261+
262+
0 commit comments