Does Titanium support drawing overlays on native map view?
In the Google maps javascript library you can draw overlays of arbitrary shapes on the map. See, for example, http://code.google.com/apis/maps/documentation/javascript/overlays.html#Polygons
Google maps in the Android SDK has something similar with the Overlay class.
I would like to draw a translucent polygonal overlay on a MapView in my Titanium application. The overlay should move around with the map as the user scrolls around. So far, I only see support for drawing "push-pin" style annotations, which is not what I want.
Does Titanium support polygonal map overlays? If not, what are some alternatives? Write a native module? Embed a webview and use the Google maps Javascript API?
4 Answers
-
Accepted Answer
This is not yet available as a core method in Ti. However, you could make a module that creates a custom annotation view for MapKit.
My recommendation is to use Google Maps v3 API and instantiate it in a webview. I have successfully used it to overlay KML data and, most recently, have integrated Google Maps direction search into an app, which you can view here:
-
I have extended Ti.Map on Android to support polygons, routes & shapes, named overlay sets (which allow you to turn a set of annotations/polys on/off) and put in the framework to allow custom overlays from modules others might write.
I was hoping it would get into 1.4 but Ti are snowed under so it looks like it might not make it in this release.
If you're comfortable with compiling Ti yourself - you can follow the feature branch for it: http://github.com/dasher/titanium_mobile/commits/master-integration/
-
I've also done some work on Routes for Android - haven't done overlays yet as David has, but you can download my custom 1.8.0 SDK with route support from here if you would like to try it out. http://boydlee.com/appcelerator-titanium/addroute-support-in-android-for-titanium-1.8.0.html
-
You can use a free module from marketplace. Here the docu: //http://www.netfunctional.ca/apps/mapoverlay/documentation/. The polygons are also clickable.