Optimizing Maps, tips and tricks
As
test_user1
view theBoulder
map and click on thelayer menu
in the top-left corner.Expand the datasets list and highlight the
Mainrd
one. Click on theproperty tool
Switch to the
view
options tab, you will notice a few settings that can be tweaked on each dataset to improve the map quality or rendering speedFormat: This allows us to set the output media type from the ones supported by the spatial service.
Tile Size: This value is usually set to
256x256
pixels, GeoNode sets them to512x512
. This value allows us to send tiled requests to theTile Service
. A larger size allows GeoNode to reduce the number of requests per dataset.Visibility Limits: Has the same effects as the
Scale Denominator
rules on the styles. The two options are always applied independently.Transparent: When
enabled
, it allows the server to render thealpha
transparent channel where no data is present.Use cache options: decides whether or not to use the tile service (
WMTS
) or (WMS
).Single Tile: When
enabled
GeoNode won’t create tiled requests for this dataset but will create a single tile with the dimensions of the current viewport. In some cases, this might speed up the rendering by drastically reducing the number of requests. Be aware thatSingle Tile
will never use the server cache.
For this dataset, let’s change the output format to
jpeg+png8
and set theMin Scale
to some value to hide the dataset at higher zoom levels.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 dataset, but it will also reduce its quality. That option is typically only useful on raster imagery.
You can also edit other available datasets:
Change the output format to
PNG8
, on vectorial datasets with few colours (like in the above case). This will greatly reduce the size of the images, resulting in an overall speedup of the dataset.Open the
Network
tab of the browser and inspect theows
requests. Notice the different output formats of the requests for the dataset. Do some tests by changing the output format, and notice the difference between the sizes and timings of the outcomes.Also, by expanding the
Headers
section, you will see how thegeowebcache
responses match with aCache HIT
, meaning that we are correctly asking for cached tiles to theWMTS
service
It is also possible to select and edit the default style of a dataset from a map by clicking on the dropper
icon as shown below.
When changing the settings for datasets on a map with many overlays, it is good practice to temporarily deactivate the other layers to speed up the work by avoiding loading all of the layers every time
Let’s edit the options for the
Mainrd
dataset. Click on theFilter
option, and check theArea of Interest
optionsChange the
Filter Type
toPolygon
, and theGeometry Operation
toContains
. Draw apolygon
on the map and clickApply
Try modifying the
Geometry Operation
toContains
and note the differencesSave the filter and go back to the map. Notice that a small
filter icon
now appears near the dataset name, and the map only shows the filtered featuresYou can optionally persist the changes on the map.
Attributes Media Types Rendering on GetFeatureInfo
The GetFeatureInfo
is a special operation in the OWS
protocol that allows us to query a dataset on a specific position to get back the values stored on the backend.
In the case of a VECTORIAL
dataset, the outcome of the GetFeatureInfo
is basically a set of records
(i.e. key-value
pairs where the keys
are the attributes
from the schema
below).
In the simplest use case, the outcome of the GetFeatureInfo
is a plain text report of the list of attributes
along with the values
of 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 can also apply, eventually, an HTML template
to the GetFeatureInfo
outcome. That means that GeoNode can render the output as HTML
content.
From the dataset metadata, there’s the possibility to edit
such a template
. In particular, there are two different ways to enable it:
Basic: GeoNode will present the available
attributes
list, allowing the user to change the order, visibility, andmedia-type
on each attribute.Advanced: GeoNode will present a
rich-text
editor panel allowing the user to define its own customHTML template
.
In this section, we will see how the basic
one works by defining and editing a new empty dataset
.
Let’s first create a new
empty dataset
with the following attributes:geometry type
:Polygon
image
:String
video
:String
audio
:String
href
:String
Edit the layer data and add a new
polygon
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/
Save, click on the polygon, and look at the results
Now go back to the dataset details, edit the metadata, and move to the
Attributes
tab. Change the contents as shown in the figureSave, visualize the dataset, and click on the polygon again