Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Drop multiple pins (locations) from database

I have an idea for an app, and part of it will be storing a location (lat,long) in a local db. I plan on having a button that the user can click that will basically loop through and drop the pins on the Mapview.

I looked at the KitchenSink, and am wondering if basically I'll select from my db, and have a do..while of this code, subbing X for the iteration, and the appropriate lat/long/etc.

var apple[x] = Titanium.Map.createAnnotation({
    latitude:37.33168900,
    longitude:-122.03073100,
    title:"Steve Jobs",
    subtitle:'Cupertino, CA',
    pincolor:Titanium.Map.ANNOTATION_GREEN,
    animate:true,
    rightButton: '../images/apple_logo.jpg',
    myid:[x] // CUSTOM ATTRIBUTE THAT IS PASSED INTO EVENT OBJECTS
});

Then paste and modify this code to drop the pins




// CREATE MAP VIEW
//
var mapview = Titanium.Map.createView({
    mapType: Titanium.Map.STANDARD_TYPE,
    region:{latitude:33.74511, longitude:-84.38993, latitudeDelta:0.5, longitudeDelta:0.5},
    animate:true,
    regionFit:true,
    userLocation:true,
    annotations:[apple[x]]
});

if (!isAndroid) {
    mapview.addAnnotation(atlanta);
}
mapview.selectAnnotation(atlanta);
win.add(mapview);

I'm wondering if there is a better way to store and pull this though before I add it to the map, especially the "annotations:[apple[x]]"…

— asked October 21st 2010 by Josh Lewis
  • geolocation
  • map
0 Comments

0 Answers

The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.