MapModulePlugin.MapLayerVisibilityRequest RPC
Allows user to change map layer visibility.
Use cases
- Hide or show map/vector layer on a map
Description
Requests a layer to be shown or hidden on a map. Triggers mapLayerVisibilityChangedEvent.
Parameters
(* means the parameter is required)
Name | Type | Description | Default value |
---|---|---|---|
\* MapLayerId | String | id of map/vector layer used in Oskari.mapframework.service.MapLayerService | |
\* visible | Boolean | should map/vector layer be visible or not |
Examples
Hide map layer on a map
var sb = Oskari.getSandbox();
visibilityRequestBuilder = sandbox.getRequestBuilder('MapModulePlugin.MapLayerVisibilityRequest');
if (visibilityRequestBuilder) {
var request = visibilityRequestBuilder(this._layer.getId(), false);
sandbox.request(this, request);
}
Hide vector layer on a map
var vectorLayerId = 'VECTOR';
var sb = Oskari.getSandbox();
visibilityRequestBuilder = sandbox.getRequestBuilder('MapModulePlugin.MapLayerVisibilityRequest');
if (visibilityRequestBuilder) {
var request = visibilityRequestBuilder(vectorLayerId, false);
sandbox.request(this, request);
}
Related api
- afterMapLayerVisibilityChangedEvent