The Smart Devices Map (SD Maps) control provides an elegant way for displaying locations using a map and interacting with them.

A location is an attribute or variable based on the Geolocation domain (link).

When you include a location in a grid control, it could be displayed as a map. For example, when you apply Work With for Smart Devices pattern over a transaction with any location attribute, the List node' target='_blank'>20429' target='_blank'>List node could be showed as a SD Map grid.

Default WorkWithSmartDevices.List object WorkWithSmartDevices.List object using SD Map Control
SD ImageGallery User Control picture1 SD Map User Control picture2

 

Using the control

For example, go to the relevant WorkWithDevices<Object> instance, select the List node' target='_blank'>20429' target='_blank'>List node, select the Grid element in the Layout editor and configure the ControlType grid property with the value SD Maps (being PropertyGeolocation an attribute representing the location of each property -hose or appartment- handled by a real estate). 

SD Maps - grid properties

Properties

There are several properties that control the behavior of the Maps control, under Control Info and Appearance sections.

Location Attribute Specifies which Geolocation attribute should the map show for each element.
Initial Zoom

Indicates what is the position where the map must center.

• Default: Show all points.
• Nearest point visible: Shows my location and at least one point near me
• Radius: Enables the Initial Zoom Radius Attribute property.

Initial Zoom Radius Attribute (/ Field Specifier)

Should be a numeric type. Indicates the minimum distance (in meters) that should be visible around the designated center point. The map's zoom level will be adjusted so that at least this distance is visible in all directions.

Center

Indicates what is the position where the map must center.

• Default: center on the point in the center of all points in the view.
• My Location: center the map on my location.
• Custom: enable the Custom Center Attribute to specify the point to be the center.

Map type

Indicates the type of map that will be used in the control.

• Standard: Shows the streets.
• Satellite: Shows satellite images of the earth.
• Hybrid: Shows the streets over the satellite images.

User can choose map type If this property is True, there will be a button on screen allowing the user to choose the type of map in runtime.
Pin Image ​You can use this property to set an image from the KB to be used as the pin image for all the pins that appear on the map.
If you don't set this property (or the Pin Image Attribute, see bellow), the default pin image for the platform is used. (*)
Pin Image Attribute Also, you can provide one pin image for each pin, by setting this attribute in the Map control.
If this property is not set or the attribute has an empty value, then the pin image is taken from the Pin Image property (if set) or the default pin for the platform is used. (*)
Show Navigation on Full Screen When the application is executing in Full Screen (iPad only, setting the property Navigation Style property = Flip under Platforms/iPad), the map can hide automatically the navigation controls (navigation bar, toolbar, filters), by setting this property to False. The default value is True.
Show My Location If this property is True, shows the current device position.
Pin Show My Location Also, you can provide one pin image for your current position. If this property is not set or the attribute has an empty value, then the pin image is taken from the Pin Image property (if set) or the default pin for the platform is used.
Rows (Grid) If this property is <default>, a limitted number of registers will be fetched from the server: 25 registers in iPad, 15 registers in iPhone and 10 in Android.
If this property is <unlimited>, the whole data will be fetched from the server.
If this property is N. The whole data will be fetched but paging the requests using N as "page size" (ie each  request will return N or less rows).

Done!

SD Maps - example

Examples

Take a look at the Map in the KB:CowBook.

Notes

  • When Show my location property is set to False, or the current location could not be determined,  the behavior will be like Initial Zoom Behavior = Show all points and Center = Default.
  • Android: to use Google Maps in an Android application, you must have an API Key from Google. If not, maps will not show. See HowTo: Get an API Key from Google
  • iOS: Street view isn't supported since the base control doesn't support it. If you need that feature, you should link to Google Maps for example. Reference: http://stackoverflow.com/a/6332475/135050
  • For a grid based on SDT, the Center Attribute (when choosing Center = Custom) you can put any attribute or variable, not necessarily one that is in the SDT.
  • (*) From GeneXus X Evolution 2 Upgrade #3, in Android devices, pin images are scaled to have the same size, not depending of the device screen resolution. In spite of every pin image size is allowed, use images with a size of 40x40 is recommended. Some references about this topic can be found here and here.

Videos

Start Video Work With for Smart Devices – General Aspects and List layout
Start Video WorkWith for Smart Devices – Detail Layout