Unofficial Content

There are two ways to calculate and show the route between Locations, in Native Mobile applications:

  1. Directions Layer property
  2. CalculateDirections method

Scope

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

Description

1. Directions Layer property

In a Panel Grid control with its Control Type property = Maps, it is possible to view the best way between one or more locations (GeoPoints) using the Directions Layer property.

When setting the Directions Layer property to True, it is possible to draw the route between the points of the Grid. Each point or position in the Grid will be given by the attribute or variable indicated in the Location Attribute property.

 SDLayer2Direction

In addition, when setting the Directions Layer property to True, two more properties are enabled to be configured: Transport Type property and Default Route Class property.
For more information, please refer to Directions Layer property.

2. Calculate Direction method

In certain cases, you don't want to draw the route beforehand because you don't have the Locations in advance, but you need them available on the spot.

To show the route between Locations, the Maps external object provides the following:

  • DirectionsCalculated event: It returns the direction between two GeoPoints after calling the method CalculateDirections.

Example

Event Maps.DirectionsCalculated(&routes, &messages) // &routes is a collection variable of the Route Structure Data Type.
    composite
         if &messages.Count = 0 
           &i = 1
           do While &routes.Count >= &i 
             &geoline = &Routes.Item(&i).geoline
             Grid1.DrawGeoLine(&geoline,"8")
             &i+=1
           enddo
        endif
    endcomposite
endevent 

To draw on a map the direction between two or more locations obtained with the Maps external object, there is a set of methods offered by the Grid of Control Type = Maps.

  • DrawGeography: It allows you to draw any Geography, specially GeoLine, in the Grid control, whose Control Type property = Maps.

  • DrawGeoLine (deprecated): It allows you to draw a GeoLine in the Grid control, whose Control Type property = Maps.

  • SetZoomLevel method: It allows you to specify the Zoom level in the Grid control, whose property control Type = Maps.

  • SetMapCenter Method: It allows you to specify the center of the Map in the Grid control, whose property control Type = Maps, using Geopoint Data type.

Show Case

  • GeoCity: I In this Knowledge Base you can find the "Pruning" section, wehre the 'RecoleccionPodas" Panel uses Directions

See Also

Layers in Maps

Last update: December 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant