DataForMapLocationEvent RPC
Notifies application that a click on the map resulted in more data for that location (GFI style content).
Description
The event allows applications to get programmatic access to the content that is normally shown on the map in an infobox
popup when the user clicks the map (GFI/wfs feature clicks). Event includes information about the click coordinates and content of the GFI response.
Note! This event is triggered for each layer and vector feature that is hit. You can detect if the events are from the same click by comparing coordinates
Parameters
(* means the parameter is required)
Name | Type | Description | Default value |
---|---|---|---|
\* x | Number | clicked x coordinate | |
\* y | Number | clicked y coordinate | |
\* content | String/Object | GFI content | |
\* layerId | Integer | Layer id which reposonse come | |
\* type | String | GFI response type, can be: json, geojson, text |
RPC
Event occurs when GFI response come.
{
"content": "{{table}}{{tr}}{{td}}test{{/td}}{{/tr}}{{/table}}", // or json object
"x": 423424,
"y": 6652055,
"layerId": 1,
"type": "text" // or json or geojson
}
Event methods
getName()
Returns name of the
getX()
Returns x coordinate
getY()
Returns y coordinate
getContent()
Returns content, can be: json, geojson or text
getLayerId()
Returns GFI response layer id
getType()
Returns content type, can be: json, geojson or text
getParams()
Returns object including all the parameters, for example:
{
x: this.getX(),
y: this.getY(),
content: this.getContent(),
layerId: this.getLayerId(),
type: this.getType()
};
Examples
GetInfoPlugin send DataForMapLocationEvent:
var dataForMapLocationEvent = Oskari.eventBuilder(
'DataForMapLocationEvent'
)(data.lonlat.lon, data.lonlat.lat, content, feature.layerId, type);
this.getSandbox().notifyAll(dataForMapLocationEvent);