Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19521] Ti.Map MapView setLocation zooms out to the maximum on Android unless latitudeDelta longitudeDelta are present

GitHub Issuen/a
TypeBug
Priorityn/a
StatusReopened
ResolutionUnresolved
Affected Version/sRelease 4.1.1
Fix Version/sn/a
ComponentsAndroid
LabelsTCSupportTriage, android, mapView, parity
ReporterDavid Fischer
AssigneeUnknown
Created2014-08-23T00:58:38.000+0000
Updated2018-02-28T19:54:59.000+0000

Description

function setLocation (e) { Ti.API.info("Annotation " + e.title + " clicked, id: " + e.annotation.myid); $.mapview.setLocation({ latitude: 32.8245525, longitude: -117.0951632, animate: true, }); } Calling that function will center the map on the specified location but zoom the map out to the maximum. The documentation makes it seem like latitudeDelta and longitudeDelta are optional. I just want to center the map, not change the zoom level. I'm not aware of any workarounds on Android. GitHub repo illustrating problem: https://github.com/davidfischer/setLocationBug The above application can be built for iOS and Android. Clicking the annotation will center and zoom the map out on Android. It only centers the map on iOS. Titanium: 3.3.0.GA Platform: 4.4.2 API: 19 Google APIs x86

Comments

  1. Harish Mridha 2014-08-26

    Hi, We tried to reproduce this issue with sample test case. It only centers the map on iOS not android. So it’s now working as expected with Titanium SDK 3.3.0.GA.

    TESTING ENVIRONMENT:

    Titanium SDK: 3.2.3.GA and 3.3.0.GA Titanium CLI: 3.3.0 OS X Version: 10.9.3 Android API Level: 19 iOS Version: 7.1.2

    TEST CODE:

    alloy.js
     
       Alloy.Globals.Map = require('ti.map');
       
    index.xml
     
       <Alloy>
         <Window id="window" class="container">
           <Module id="mapview" module="ti.map" method="createView" onClick="setLocation">
             <Annotation id='hq' myid='1' />
           </Module>
         </Window>
       </Alloy>
       
    index.tss
     
       ".container": {
       	backgroundColor:"white"
       }
       "#mapview": {
           width: Ti.UI.FILL,
           height: Ti.UI.FILL,
           userLocation: true,
           enableZoomControls: false,
           region : {
               latitude: 32.8345525,
               longitude: -117.0851632,
               latitudeDelta:0.05,
               longitudeDelta:0.05,
           }
       }
       "#hq": {
           latitude: 32.841,
           longitude: -117.092,
           title: "Somewhere",
           pincolor: Alloy.Globals.Map.ANNOTATION_RED
       }
       
    index.js
     
       function setLocation (e) {
           Ti.API.info("Annotation " + e.title + " clicked, id: " + e.annotation.myid);
           $.mapview.setLocation({
               latitude: 32.8245525,
               longitude: -117.0951632,
               animate: true,
           });
       }
       
       $.window.open();
       

    STEPS TO TEST:

    - Create a simple alloy project. - Update project using test code - Add Map module in tiapp.xml - Run on android/iOS device

    EXPECTED RESULT:

    It’s a valid bug. Thanks
  2. David Fischer 2014-10-28

    Can you explain to me why this issue was closed? What exactly couldn't you reproduce? Nowhere in your comment was the zoom level (the problem!) even mentioned. I just reran the sample project and clicking on the annotation zoomed the map out to the maximum (on Android) which is not the expected result. From the documentation: {quote} setLocation( location ) : void Sets the map location and zoom level. The location is set using a simple dictionary object, described in MapLocationTypeV2. If latitudeDelta and longitudeDelta are set, these specified parameters bound the area of interest, which is centered and displayed at the greatest possible zoom level. This method can only be called after the map completes loading. Before that, use region to set the map location. {quote} For completeness, I ran the project with Titanium SDK 3.4.0GA and the problem persists in the current versions.

JSON Source