The map allows you to retrieve the objects that it visualizes at a particular location.
pickAt(x,y,radius) instance method of the
Map to retrieve all objects at the screen position specified by the
You can retrieve objects from selectable layers only.
You also have the option to use the
pickClosestObject(x,y,radius) instance method, to retrieve the first selectable object near the screen position specified by the
Two other methods,
pickClosestObjectRectangle, allow you to retrieve objects visible in a specific rectangular area.
You specify the rectangle by defining the position of its center point and its width and height.
By default, all those methods check if the view position overlaps with the shape visualized for the feature.
If you also want to retrieve objects when the view position overlaps with the labels of the feature, you must use the optional
It specifies the paint representation used to retrieve features:
The feature body is used to retrieve an object:
The feature label is used to retrieve an object:
If you leave this parameter out, only the feature bodies are used to retrieve the object.