Optimizing Maps, tips and tricks

  • As test_user1 edit the Boulder map

    image

  • Expand the layers list and highlight the boulder_bg_optimized one; click on the property tool

    image

  • Switch to the view options tab; you will notice few settings that can be tweaked on each layer in order to improve the map quality or speed

    • Format: Allows us to set the output media type from the ones supported by the spatial service.

    • Tile Size: Usually this value is set to 256x256 pixels; GeoNode sets them to 512x512. This value allows us to get tiled requests to the Tile Service. A higher size allows GeoNode to reduce the number of requests per layer.

    • Visibility Limits: Have the same effects of the Scale Denominator rules on the styles. The two options are always applied independently.

    • Transparent: When enabled, allows the server to render the alpha transparent channel where no data is present.

    • Use cache options: Whether or not use the tile service (WMTS) or not (WMS).

    • Single Tile: When enabled GeoNode won’t create tiled requests for this layer, but a single one of the dimension of the current viewport. In some cases this might speed up the rendering by drastically reducing the number of requests. Be aware that Single Tile will never use the server cache.

    image

  • For this layer, let’s change the output format to jpeg+png8 and set the Min Scale to some value in order to hide the layer at highest zoom levels.

    image

    The JPEG+PNG8 output format will allow GeoServer to use JPEG compressions on images and PNG8 on transparent tiles. This will reduce the size of the images speeding up the layer, but it will also reduce its quality. That option is typically useful on raster imagery only.

  • Let’s edit the options for the Streets layer

    image

  • Change the output format to PNG8; on vectorial layers with few colors, like in this case, this will reduce a lot the size of the images, resulting in an overall speed up of the layer.

    image

  • Open the Network tab of the browser and inspect the ows requests; notice the different output format of the requests for the geonode:Streets layer. Do some tries by chanigng the output format and notice the difference between the sizes and timings of the outcomes.

    image

    image

  • Also, by expanding the Headers section, you will notice how the geowebcache responses match with a Cache HIT, meaning that we are correctly asking for cached tiles to the WMTS service

    image

  • From a map it is possible also to select which one from the available styles (legends) to use on each layer; as an instance let’s use the CSS style for the Trials layer

    image

    image

  • When changing the settings for some layers on a map with many overlays, it is a good practice to temporarly deactivate the others in order to speed up the work, by avoiding to load all of them everytime

    image

  • Let’s edit the options for the Mainrd layer; click on the Filter option and check the Area of Interest options

    image

  • Change the Filter Type to Polygon and the Geometry Operation to Contains; draw a polygon on the map and click Apply

    image

  • Try modifying the Geometry Operation to Intersects and see the differences

    image

  • Let’s try some more advanced filtering options; as an instance it is possible to filter the current layer by using the geometries from some other layer on the map. Go ahead and slect the Streets layer from the Target Layer select box; change the Operation to Intersects. Add an attribute filter, as an instance LABEL_NAME to Colorado Ave. By applying the filter you’ll notice the Mainrd showing only the features matching the intersecting geometries from Streets

    image

  • Save the filter and go back to the map; notice that a small filter icon appears now near the layer name and the map shows only the filtered features

    image

  • You can optionally persist the changes on the map.

Attributes Media Types Rendering on GetFeatureInfo

The GetFeatureInfo is a special operation on the OWS protocol allwing us to query a layer on a specific position in order to get back the values stored on the backend.

In the case of a VECTORIAL layer, the outcome of the GetFeatureInfo is basically a set of records, i.e. key-value pairs where the keys are the attibutes from the schema below.

In the simplest use case the outcome of the GetFeatureInfo is a plain text reporting the list of attributes along with the values on that specific location. As you can imagine, the values can be almost anything, even references to external links or media contents, like images, videos or audios.

GeoNode is also able to apply, eventually, an HTML template to the GetFeatureInfo outcome. That means that GeoNode can render the output as an HTML content.

From the layer metadata there’s the possibility to edit such template. In particular there are two different ways to enable it:

  1. Basic; GeoNode will simply present the list of the available attributes allowing the user to change the order, visibility and media-type on each one.

  2. Advanced; GeoNode will present a rich-text editor panel allowing the user to define its own custom HTML template.

In this section we will see how the basic one works by defining and editing a new empty layer.

  • Let’s first create a new empty layer with the following attributes:

    • geometry type: Polygon

    • image: String

    • video: String

    • audio: String

    • href: String

    image

  • Edit the layer data and add a new polygon

    image

  • Fill the attributes with some links, e.g.

    • image: https://asia.olympus-imaging.com/content/000107506.jpg

    • video: https://www.youtube.com/watch?v=-ucUFBTUYLI

    • audio: https://samplelib.com/lib/preview/mp3/sample-3s.mp3

    • href: https://geonode.org/

    image

  • Save, click on the polygon and check the results

    image

  • Now go back to the layer details, edit the metadata and move to the Attributes tab; change the contents as shown in the figure

    image

  • Save, visualize the layer and click again on the polygon

    image

    image