-
Notifications
You must be signed in to change notification settings - Fork 0
Layer properties
The primary use case for this GNaP Map library is displaying layers of GeoJson features on different map technologies, where the GeoJson data comes from a REST backend.
The layer configuration is stored in an object which contains a property per layer. The property name is the name of the layer, and its value is an object which defines its behavior, appearance, and other things. The following properties must/can be specified per layer:
Type: required, string
Example:'block'
The unique name of the layer. This must be the same as the layer property name.
Type: required, string
Example:'blocks'
The end-point name to call on the REST API.
Type: required, int
Example:5
The minimum zoom level, between 0 (highest) and 10 (entirely zoomed in) at which to display this layer. In case displaying or hiding this layer is more complicated than mere using the zoomLevel, this can be specified in a custom shouldShowFunction
. A zoom level of 0 generally means 'always show'.
Type: optional, int
Example:2
Optionally specify a maximum zoom level, between 0 (highest) and 10 (entirely zoomed in) at which to display this layer.
Type: required, bool
Default:false
Actually shows or hides the layer. This property is altered by the layer switches, but this property decides the 'initial' value.
Type: optional, bool
Default:false
When set to true
, clicking this feature will have no behavior.
Type: optional, string
Example:'main.map.layerId'
When provided, uses this string as the translation id. If none is provided, itemType
property is used as the translation id leaf, appended to what was configurated through setTranslationLocaionBase
.
Type: optional, string
Example:'img/signs/wifi.png'
The link to the icon to be displayed. Only for feature types which are 'points'.
Type: optional, int
Example:1
Allows to set a custom z-index for this feature type. Higher value = more dominant. If nothing is set, the minZoomLevel
is used. A map technology that sets the z-index along with the style can overwrite this behavior using the getStyleFunction()
function.
Type: optional, bool
Default:false
When set to true
, the application will fetch all features of this type upon first charging the layer (passing the all
flag to the constructResourceUriFunction
function), and cache the results locally. From then on, when charging the features for the active view port, they will be queried from this cache in-memory.
Note: this will greatly reduce network traffic, and for small amounts of data (generally < a few thousands) this will greatly improve the user experience. However, this will start consuming CPU on the client. For lots of layers with a lot of data (in total > a few thousands), this might start freezing up the browser.
Use this for relatively small amounts (in total, a couple of thousands) of static points of interest.
Type: optional, bool
Default:false
By default (when false
), once a feature has been displayed and stays in the view port, it is not redrawn. Setting this flag to true
, you can force redrawing it when the zoom level changes. Use this when the shape of the feature (as specified by its setStyleFunction
) depends on the zoom level.
Type: optional, bool
Default:false
Set this to true
to always fetch the data from the server again and redraw it. Use this flag when the returned data depends on the entire, precise view port; such as heatmap data generated on the server.
Type: optional, bool
Default:false
Set this to true
for data layers which have a position that has possibly moved in between two fetches from the server. This property should be used by the map view engine, to try to avoid flickering when re-drawing a feature.
Type: optional, function
Parameters:dataLayer
,zoom
,dataLayers
Returns:boolean
Whether or not to display this layer.
Type: optional, function, map-specific
Parameters:feature
Returns:object or function
The map-tech-specific code (can be an object or a function) to display this layer. When not supplied, the default is used (this default is defined on the map's mapView directive).
Type: optional, function, map-specific
Parameters:feature
,icon
,layerProperties
,zoomLevel
Returns:object or function
When set, the map view should use this function to render a label for this feature.
You are free to add any number of additional properties to your layer config objects. You can reference these throughout your application, or in your shouldShowFunction
s and setStyleFunction
s.