Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4617564
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:08:31+00:00 2026-05-22T02:08:31+00:00

I am making an app in which i have to show Map in my

  • 0

I am making an app in which i have to show Map in my Application.
I am able to show map and able to add Markers using annotation on Mapview.

Problem is
1> I am not able to show multiple markers on map.

So any body can help me how i can add multiple markers on Map.

Thanks,

Rakesh

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T02:08:32+00:00Added an answer on May 22, 2026 at 2:08 am

    Here is a map class that I use. You would include this map.js file in your window and call map.init and pass in an array of map annotations to add, the center lat/long, the top and bottom positions of the map, and optionally the lat/long delta. If you want to dynamically add annotations after the map has already been created then you can call the other functions in the class to do so:

    var path = Ti.Platform.name == 'android' ? Ti.Filesystem.resourcesDirectory : "../../";
    
    var map = {
    
        top: 0,
        bottom: 0,
        latitude: 0,
        longitude: 0,
        latitudeDelta: 0.1,
        longitudeDelta: 0.1,
        display: "map",
    
        init: function (annotations, latitude, longitude, top, bottom, delta) {
    
            if (top)
                map.top = top;
            if (bottom)
                map.bottom = bottom;
            if (delta) {
                map.latitudeDelta = delta;
                map.longitudeDelta = delta;
            }
    
            map.createMap(annotations, latitude, longitude);
            map.createOptions();
            map.getLocation();
    
        },
    
        createMap: function (annotations, latitude, longitude) {
    
            map.mapView = Ti.Map.createView({
                mapType: Ti.Map.STANDARD_TYPE, animate: true, regionFit: false, userLocation: true,
                region: { latitude: latitude, longitude: longitude, latitudeDelta: map.latitudeDelta, longitudeDelta: map.longitudeDelta },
                annotations: annotations, bottom: map.bottom, top: map.top, borderWidth: 1
            });
            if (!isAndroid) {
                map.mapView.addAnnotation(annotations[0]);
            }
            map.mapView.selectAnnotation(annotations[0]);
            win.add(map.mapView);
    
        },
    
        createOptions: function () {
    
            //map/satellite displays.
            var mapDisplay = new ImageView({ image: path + 'images/map/satellite-view.png', width: 70, height: 49, zIndex: 2, top: map.top + 5, right: 5 });
            mapDisplay.addEventListener('click', function () {
                if (map.display == "map") {
                    map.mapView.setMapType(Titanium.Map.SATELLITE_TYPE);
                    mapDisplay.image = path + "images/map/map-view.png";
                    map.display = "satellite";
                }
                else {
                    map.mapView.setMapType(Titanium.Map.STANDARD_TYPE);
                    mapDisplay.image = path + "images/map/satellite-view.png";
                    map.display = "map";
                }
            });
            win.add(mapDisplay);
    
            //crosshairs.
            if(Ti.Geolocation.locationServicesEnabled) {
                var centerDisplay = new ImageView({ image: path + 'images/map/crosshairs.png', width: 49, height: 49, zIndex: 2, top: map.top + 5, right: 80 });
                centerDisplay.addEventListener('click', function () {
                    if(map.latitude != 0 && map.longitude != 0) {
                        info("setting user location to " + map.latitude + " / " + map.longitude);
                        //center map.
                        var userLocation = {
                            latitude: map.latitude,
                            longitude: map.longitude,
                            latitudeDelta: map.latitudeDelta,
                            longitudeDelta: map.longitudeDelta,
                            animate: true
                        };
                        map.mapView.setLocation(userLocation);
                    }
                    else {
                        info("Can't get user location, lat and long is 0!");
                    }
                });
                win.add(centerDisplay);
            }
    
        },
    
        createAnnotation: function (title, subtitle, latitude, longitude, isLocation, addToMap) {
    
            var mapAnnotation = Ti.Map.createAnnotation({
                latitude: latitude, longitude: longitude,
                title: title,
                subtitle: subtitle,
                animate: true
            });
            if (isAndroid) {
                mapAnnotation.pinImage = path + (isLocation ? "images/map/blue-pin.png" : "images/map/purple-pin.png");
            }
            else {
                mapAnnotation.pincolor = isLocation ? Ti.Map.ANNOTATION_PURPLE : Ti.Map.ANNOTATION_RED;
            }
    
            if (addToMap)
                map.mapView.addAnnotation(mapAnnotation);
    
            return mapAnnotation;
    
        },
    
        updateAnnotation: function (mapAnnotation, title, subtitle, latitude, longitude, isLocation) {
    
            if (mapAnnotation) {
                map.mapView.removeAnnotation(mapAnnotation);
                mapAnnotation = map.createAnnotation(title, subtitle, latitude, longitude, isLocation);
                map.mapView.addAnnotation(mapAnnotation);
                map.mapView.selectAnnotation(mapAnnotation);
            }
    
        },
    
        addAnnotation: function (mapAnnotation) {
    
            map.mapView.addAnnotation(mapAnnotation);
    
        },
    
        removeAnnotation: function (mapAnnotation) {
    
            map.mapView.removeAnnotation(mapAnnotation);
    
        },
    
        selectAnnotation: function (mapAnnotation) {
    
            map.mapView.selectAnnotation(mapAnnotation);
    
        },
    
        createRoute: function (name, points) {
    
            var route = {
                name: name, points: points, color: "#7c74d4", width: 4
            };
            map.mapView.addRoute(route);
            setTimeout(function () { map.mapView.regionFit = true; }, 700);
    
        },
    
        getLocation: function() {
    
            Ti.Geolocation.preferredProvider = Ti.Geolocation.PROVIDER_GPS;
            Ti.Geolocation.purpose = "testing";
            Ti.Geolocation.accuracy = Ti.Geolocation.ACCURACY_BEST;
            Ti.Geolocation.distanceFilter = 10;
    
            if(!Ti.Geolocation.locationServicesEnabled) {
                //alert('Your device has GPS turned off. Please turn it on.');
                return;
            }
    
            function updatePosition(e) {
                if(!e.success || e.error) {
                    info("Unable to get your location - " + e.error);
                    return;
                }
                info(JSON.stringify(e.coords));
                map.latitude = e.coords.latitude;
                map.longitude = e.coords.longitude;
                Ti.Geolocation.removeEventListener('location', updatePosition);
            };
    
            Ti.Geolocation.getCurrentPosition(updatePosition);    
            Ti.Geolocation.addEventListener('location', updatePosition);
    
        }
    
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making an android app in which i have to show Hash Tag
I am making an app in which I have to play video file. .flv
I am making an app in which I have to retrieve the phone number
I am making an app in which i have a main activity that the
I am making an app in which I have to open default audio player.
I am making an App in which i have to play music from iPod
Iam making an app which has one index.php file. I also have these other
i m making APP which do image proceesing using java SE.i want to check
I am making an app in which i have to save some string in
I am making an app in which i have to draw image in canvas

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.