Adding Hover-Over Popups to A Layer
===================================
GeoMOOSE supports hover-over popups on both Vector (WFS) and Raster Layers (WMS/MapServer).
Adding Popups To WFS Layers
---------------------------
Adding popups to Vector layers requires adding the HTML template to the ``map-source`` configuration and the ``popups=true`` attribute to its catalog entry.
The HTML Template
^^^^^^^^^^^^^^^^^
The HTML templates are Dojo-type string templates. They are slighty different than MapServer templates and use ``${attribute}`` formatting::
...
${namelsad}
Area of Land: ${aland}
Area of Water: ${awater}
Census Info Page
]]>
And in the catalog, ``popups="true"`` is added to the ```` entry::
Adding Popups to WMS Layers
---------------------------
The demo includes functionality for WMS popups for both points and polygon representations of the Parcels layer.
The steps required:
1. Create a HTML template.
2. Enable WMS Queries in the Mapfile.
3. Enable Popups for the Layer in the Mapbook.
Create a HTML Template
^^^^^^^^^^^^^^^^^^^^^^
The HTML templates are standard MapServer templates. The reference for them can be found on the MapServer website. This is the example included in the GeoMOOSE Demo::
PIN: [PIN]
Owner: [OWNER_NAME]
View Parcel Report
Attributes are substituted using ``[`` and ``]``. GeoMOOSE can also startup other services from links provided in popups as seen above.
Enable WMS Queries in the Mapfile
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
MapServer requires a few key elements to be included in order to WMS queries to work.
1. ``WEB``'s ``METADATA`` must include ``wms_feature_info_mime_type`` set to ``text/html``. ::
WEB
...
METADATA
...
'wms_feature_info_mime_type' 'text/html'
END
END
2. The ``LAYER`` must have a ``CLASS`` with a ``NAME``.
3. The ``LAYER`` must also have a template ending in ``.html``::
LAYER
NAME 'parcel_points'
CLASS
NAME 'Parcels!'
...
END
# this references the html file above
TEMPLATE 'parcels_popup.html'
END
Enable Popups in the Catalog
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
``popups="true"`` is added to the ```` entry in the catalog::