overHere is an SDK that wraps access to the Here.com location platform resources for VFP applications. Functionalities like map imagery and enrichment, route calculation, and geocoding, are already available, with others to follow as the SDK keeps growing.
Invoking the services and fetching their responses is done through a set of classes that encapsulate the REST calls to Here.com servers.
Developers using overHere must refer to the Here.com API documentation for implementation details. The overHere documentation will focus on how to set the calls and on how results are structured.
The SDK source is divided into datatype classes and resource (API) classes.
Datatype classes define the objects used to access the Here location platform, such as geo coordinate boundaries of a region in a map, and the structured response that the platform returns, such as the steps of a route between two points.
The datatype classes are used by the resource classes to parameterize the calls to the platform services and to interpret and communicate the result to the application.
The resource classes are generally composed of OH (overHere) datatype objects that may be set by the application, and of Get methods that fetch the information from the platform (for instance, GetLocation()
or GetImage()
) and store it in a response object.
Applications don’t instantiate the resources classes directly. Instead, they use overHere
, a manager class that organizes the access to the platform and the instantiation of resource classes through a SetResource() method.
Further documentation:
Access to Here.com resources requires registration and, at least, the setting up of a project. See the Here.com website for details.
In the examples folder, a few forms illustrate the use of the SDK.
MapViewer.scx
, to display maps of a regionStatistics.scx
, to display geolocalized visual dataGeocoder.scx
, to search geo coordinate locationsItineraries.scx
, to calculate routes and to display their stepsAutoComplete.scx
, to get a list of geocode suggestions.AutoComplete-Async.scx
, to get a list of geocode suggestions in asynchronous mode.
Geocoder.scx
may provide information for MapViewer.scx
and Itineraries.scx
forms, so it may desirable to keep them open at the same time.
In each one of these forms, the call to Here.com resources can be found in self-contained methods. A developer should read the code in GetImage()
, GetLocation()
, GetRoute()
, and GetSuggestions()
methods to get a first understanding of the operation of overHere, and to take them as examples of how a VFP application can integrate Here.com resources.
In this demo, a map of New York is displayed in the VFP main window using the Here.com MapView resource. It can be executed directly from the command window.
Install the libraries:
DO LOCFILE("here_loader.prg")
Instantiate an overHere API manager and set Here.com credentials:
m.oh = CREATEOBJECT("overHere")
m.oh.SetCredentials("{your API Key}")
Instantiate a MapView object through the API manager:
m.mv = m.oh.SetResource("MapView")
Set location and map type parameters:
m.mv.CountryName.Set("USA")
m.mv.CityName.Set("New York")
m.mv.MapScheme.Set(3)
Create an image object in the VFP _Screen:
_Screen.AddObject("map", "Image")
Fetch the map and load it into the image:
_Screen.map.PictureVal = m.mv.GetImage(.T.)
Display the image
_Screen.map.Visible = .T.
A map view centered in 10 Downing St., London. Satellite and traffic displays are combined into a single image. A VFP Image control is used to display the map in the form after it's fetched from Here.com servers.
A route calculated from Lisbon to Paris,
and a segment of the route, when it reaches the Portuguese-Spanish border. The overall distance of the journey is about 1735 km, while this segment has a length of 35 km, approximately.
Some of the classes depend on JsonToXML
, a simple Json to XML converter (see VFP XML library set GitHub repository for details).
For convenience, the required program files are stored in the api\external
folder.
In development. Unsuited for production, unless thoroughly tested on site. Unlicensed.