The new maps component in RAD Studio XE8 simplifies the addition of mapping functionality to mobile applications. TMapView provides map API access for iOS and Android. It makes use of the Google Maps Android API on Android and the Map Kit Framework on iOS.
The key features of the TMapView component are:
- Four Types of Maps: Normal, Satellite, Hybrid and Terrain (Android only)
- Gesture Control: Intuitive tilt, rotate and zoom gesture controls
- Control the Map View: Ability to control the map properties such as the map center coordinates, the map orientation and so on
- Custom markers: Ability to add markers to the maps
If you are using TMapView on Android, you will need to obtain a Google Maps API key.
RAD Studio XE8 ships with two maps sample applications for Object Pascal and C++.
Object Pascal:
- C:UsersPublicDocumentsEmbarcaderoStudio16.0SamplesObject PascalMobile SamplesDevice Sensors and ServicesMaps
- C:UsersPublicDocumentsEmbarcaderoStudio16.0SamplesObject PascalMobile SamplesDevice Sensors and ServicesMap Type Selector
C++:
- C:UsersPublicDocumentsEmbarcaderoStudio16.0SamplesCPPMobile SamplesDevice Sensors and ServicesMaps
- C:UsersPublicDocumentsEmbarcaderoStudio16.0SamplesCPPMobile SamplesDevice Sensors and ServicesMap Type Selector
I created a small demo project that uses the Spitcast REST API, REST component framework, FDMemTable and TMapView to display surf locations on my map based on the longitude, latitude and spot name information returned from the REST service. A custom marker graphic in the shape of a surfboard fin is used to indicate the locations on the map.
You can download my demo project here.
Here is a code snippet from the demo project:
Here is the app running on my iPad:
Here is a quick code snippet on how to clear the markers on the map: