Table of contents

 

 


Official Content

Geocoding is the process of transforming a description of a location (such as a pair of coordinates, an address, or the name of a place) into a location on the Earth's surface.

To geocode an address or to reverse geocode a coordinate (Geopoint), the following methods are available in the Maps external object:

  1. GeocodeAddress method
  2. ReverseGeocode method

Samples


1. GeocodeAddress method (Maps external object)

   &Locations = Maps.GeocodeAddress("Plaza Independencia, Montevideo, Uruguay")
   for &GeoPoint in &Locations
       &Latitude =  &GeoPoint.Latitude
       &longitude = &GeoPoint.Longitude
       //do something with the &Latitude and &longitude variables
   endfor


2. ReverseGecode method (Maps external object)

   &GeoPoint = GeoPoint.New(-34.8910275746741, -56.18720064473088) 
   &CollectionChar = Maps.ReverseGeocode(&GeoPoint)  

   For &Char in &CollectionChar
     &PlaceName = &Char
     //do something with the &PlaceName variable
   EndFor

In this sample, the &GeoPoint variable (based on the GeoPoint data type) is loaded with the coordinates of a mall in Montevideo. After that, the ReverseGecode method is used to load the &CollectionChar variable with a list of place names that correspond to the &GeoPoint coordinates. Finally, the collection is scanned to use each place name.
 

Note: The Geolocation external object (deprecated) offers similar methods based on the Geolocation domain (deprecated too). Their names are GetLocation and GetAddress.

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