Official Content

This article explains how to implement Map navigation to select a Location (in other words, how to use the Selection Layer).

When you include in a Panel object a Grid control with its Control Type property set to Maps, it is possible to enable a navigation mode that allows you to select a location (a GeoPoint). In this navigation, there is an icon in the center that remains fixed and you can move the map to select a position (and get its coordinates). This is handled with the Selection Layer property

Scope

Controls: Grid (Control Type: Maps)
Generators: Android, Apple

Description

First, set the Grid Selection Layer property to True. This will make it possible to move on the map at runtime, having a fixed icon in the center that obtains the position and triggers an event.

The navigation is similar to what is achieved using the PickLocation Method.

SDlayer1Selection

The icon can be configured using the Location Selection Target Image property. Also, by setting the Selection Layer property = True, the Selection Target Image Class property is enabled to associate a class to that image (by default, there is a class created under the name: SDMapPinImage).

In addition, by setting the Selection Layer property = True, two events are available: ControlValueChanging and ControlValueChanged.

ControlValueChanging(GeoPoint) event

This event is triggered while the map is moving. For example:

Event Grid1.ControlValueChanging(&geoPoint)
       composite
            msg(&geoPoint.Tostring())
      endcomposite
Endevent

ControlValueChanged(GeoPoint) event

This event is triggered when you stop moving the map. For example:

Event Grid1.ControlValueChanged(&geoPoint)
       composite
            msg(&geoPoint.Tostring())
       endcomposite
Endevent

You get the position to which the map was moved in the GeoPoint type parameter.

The code in the example shows the string corresponding to the position to which the map was moved (i.e.: POINT(Long Lat)).

The event ControlValueChanged is overloaded with values; therefore, the parameter could be of Character type (instead of GeoPoint).

Showcase

GeoCity: In this Knowledge Base you can find the "Pruning" section, where the "RecoleccionPodas" (Pruning Collection) Panel object uses Selection.

See Also

Layers in Maps

 

Last update: March 2025 | © GeneXus. All rights reserved. GeneXus Powered by Globant