Skip to content

Commit f710af8

Browse files
authored
Merge pull request #952 from chughes-lincoln/how-to-updates-v2
How to updates v2
2 parents 267f85a + d3f3335 commit f710af8

8 files changed

Lines changed: 202 additions & 24 deletions

File tree

docs/howto/addlayer/add-a-layer.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,5 @@ Add Firestations to the catalog
5555
Using identify with Firestatations
5656
----------------------------------
5757

58-
The:doc:`./add-identify` guide
59-
features the firestations layer. And describes adding identify and how
60-
identify works.
58+
The :doc:`/howto/identify/add-identify` guide
59+
describes how identify works and how to add it (using the firestations layer as an example).

docs/howto/identify/add-identify.rst

Lines changed: 96 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ The Firestations layer
121121

122122
This 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`
125125
guide.
126126

127127
Adding 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+
18.3 KB
Loading

docs/howto/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ How-Tos
66
.. toctree::
77
:maxdepth: 3
88
:glob:
9+
:titlesonly:
910

1011

1112

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,13 @@
11
How-to add a Grid to Search and Identify
22
========================================
33

4-
Add show grid to the service configuration
5-
------------------------------------------
6-
7-
::
8-
9-
app.registerService('search', SearchService, {
10-
showGrid: true,
11-
...
12-
});
13-
14-
Add template links in the mapbook.
4+
Add template links in the mapbook
155
----------------------------------
166

177
- For search the templates are named ``search-grid-columns`` and
18-
``search-row``.
8+
``search-grid-row``.
199
- For identify the templates are named ``identify-grid-columns`` and
20-
``identify-row``.
10+
``identify-grid-row``.
2111

2212
The search example is shown below:
2313

@@ -26,24 +16,47 @@ The search example is shown below:
2616
<template name="search-grid-columns" src="./templates/parcel-columns.json" />
2717
<template name="search-grid-row" src="./templates/parcel-row.html" />
2818

29-
Re-using templates in other services
30-
------------------------------------
19+
Add a search alias to the service configuration
20+
------------------------------------------------
3121

32-
It can be useful to use the same templates for different services. For example,
33-
if the same data should be returned for two different types of search templates.
22+
Adding a search alias allows the ``search-grid-columns`` and ``search-grid-row``
23+
templates to be used for search services that aren't named search, while still
24+
allowing you to point to different template files for the individual services.
3425

35-
To add the grid results, using the ``search`` templates to ``single-search`` make
26+
To add an alias, allowing you to use the ``search`` templates for ``single-search``, make
3627
the following changes to ``app.js``:
3728

3829
::
3930

4031
app.registerService('single-search', SearchService, {
4132
...
33+
// this tells GeoMoose to use "search" templates instead of "single-search"
34+
alias: 'search'
35+
});
36+
37+
Further customize the search service
38+
------------------------------------------
39+
40+
You can also change some of the default search options, like overwriting the title,
41+
zooming to results, or having the grid be minimized by default.
42+
43+
::
44+
45+
app.registerService('single-search', SearchService, {
46+
...
47+
// this overwrites the service title
48+
title: 'Simple Search'
49+
// this overwrites the results title
50+
resultsTitle: 'Simple Search Results'
51+
// this tells the service to zoom to the results by default
4252
zoomToResults: true,
4353
// this will enable the grid
4454
showGrid: true,
4555
// this tells GeoMoose to use "search" templates instead of "single-search"
46-
alias: 'search'
56+
alias: 'search',
57+
// this tells the service that the grid results should be minimized by default
58+
gridMinimized: true
4759
});
4860

61+
You can find more examples of how to customize your results at :doc:`customize-results`.
4962

docs/howto/search/add-search.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Add a supported vector map-source
1111

1212
This how-to references the ``firestations`` source and ``fire_stations``
1313
layer. For more information on setting those up in your local demo, read
14-
the:doc:`./add-a-layer` guide. This example
14+
the :doc:`/howto/addlayer/add-a-layer` guide. This example
1515
creates a WFS-source for the Firestations layer.
1616

1717
Add the following to ``mapbook.xml``:
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
How-to avoid catalog legend overlap
2+
====================================
3+
4+
If your catalog has very long legends, or many legends open at once in a
5+
single group, the legends can overlap with layers beneath them, similar
6+
to this example:
7+
8+
.. figure:: /howto/images/catalog-legend-overlap.png
9+
:alt: Catalog Legend Overlap
10+
11+
Catalog Legend Overlap
12+
13+
14+
15+
If this happens, it can be avoided by changing the height of the
16+
children element in the site's ``site.css`` file, from the default
17+
height of 2000px, to whatever value is needed.
18+
19+
Change site.css
20+
------------------------------------------
21+
22+
.. code:: css
23+
24+
.group.gm-expand .children {
25+
max-height: 3000px;
26+
}
27+
28+
29+
30+

docs/howto/tabs/hide-catalog.rst

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
How-to hide the catalog tab
2+
============================
3+
4+
Sometimes administrators of a site may want the catalog tab to be minimized by
5+
default. This can be useful for both small screens and for embedding your
6+
map in other websites. This can easily be done by making a simple edit to the
7+
``index.html`` file.
8+
9+
Change index.html
10+
------------------------------------------
11+
12+
In ``index.html``, find the body tag and add a tabs-closed class to it.
13+
14+
Default site configuration with the catalog tab open by default:
15+
16+
.. code:: html
17+
18+
<body>
19+
<div id="main">
20+
<div id="header">
21+
<img height="50" src="logo.png">
22+
<div id="toolbar"></div>
23+
</div>
24+
...
25+
26+
Site configuration with the catalog tab minimized. Note that there is a
27+
space before tabs-closed (without the space the catalog tab is minimized
28+
by default, but you can't unminimize it):
29+
30+
.. code:: html
31+
32+
<body class=" tabs-closed">
33+
<div id="main">
34+
<div id="header">
35+
<img height="50" src="logo.png">
36+
<div id="toolbar"></div>
37+
</div>
38+
...
39+
40+

0 commit comments

Comments
 (0)