My location example for the RESTful Map API on Symbian Web Runtime app
This example shows on how you can build a wrapper API for accessing the RESTful Map API service on Nokia Symbian Web Runtime apps. The same wrapper though could be easily ported to be working on any web browser, since with this example all Symbian WebRuntime specific parts are located in separate js file.
All documentation for the RESTful Map API can be found from the here.
The full example of this article can be found from: M Ovi Me MyLocation.zip
With this example all positioning code is located under basic.js file, and the Maps rendering code are located inside the M_Ovi_Me_MyLocation.js file and the basic.js file is just binding these functionality together.
The Wrapper can be initialized with following line of code
mOviMe_MyLocation = new MoviMeMyLocation(nodeName,Settings);
Where the nodeName is a string that is the name of the node where the map should be put into, and the Settings is s struck having following items on it:
- zoom: zoom value,
- waitColor:color to be used in wait-screen while loading the map,
- waitOpacity:opacity value for the wait-screen
- overlayText: text used in the wait-screen,
- maptype:map type used ,
- showAdress: Boolean indicating whether the address for the point should be shown,
- showUncertainty: Boolean indicating whether uncertainty should be shown in the map
After the node wrapper is initialized, the map can be loaded with following line of code:
mOviMe_MyLocation.loadMap(lat, lon, unc);
in where the lat is latitude, lon is longitude and the unc is the uncertainty for the position to be shown in the map. The map can be then removed by calling remove() function. Other functions implemented in the wrapper are:
- lat(): returns current latitude value
- lon(): returns current longitude value
- setMapType(type): changes the map type
- setWaitText(text): sets the text in wait-screen
- setWaitColor(color): sets the wait-screen color
- setZoom(zoom): sets the map zoom