1. #1
    Sencha User
    Join Date
    Feb 2012
    Location
    Illinois
    Posts
    93
    Vote Rating
    2
    bwags is on a distinguished road

      0  

    Default Unanswered: Google.Maps Re-centering Unexpectedly.

    Unanswered: Google.Maps Re-centering Unexpectedly.


    Hey all, my apologies if this is a local settings issue but I can't seem to find documentation on this anywhere and am able to replicate it on Chrome and Safari.

    I have a map that I setup like so:


    Code:
    Ext.define('MyApp.view.Map', {    extend : 'Ext.Container',
        alias : 'widget.mapview',
    
    
        requires : [ 'Ext.Map', 'Ext.form.Panel', 'Ext.form.FieldSet' ],
    
    
        config : {
    
    
            title : "My Map",
            fullscreen : true,
            layout : 'fit',
    
    
            items : [ {
                xtype : 'map',
                id : 'theMap',
    
    
                useCurrentLocation : true,
    
    
                mapOptions : {
                    zoom : 14,
                    mapTypeId : google.maps.MapTypeId.ROADMAP,
                }
            }, {
                xtype : 'button',
                id : 'layersMenuButton',
    
    
                text : 'Options!',
    
    
                docked : 'bottom',
            }, {
                xtype : 'formpanel',
                id : 'layerFormPanel',
    
    
                height : '50%',
                width : '80%',
    
    
                modal : true,
                hideOnMaskTap : true,
                centered : true,
                hidden : true,
    
    
                items : [ {
                    xtype : 'fieldset',
                    title : 'Layers',
                    id : 'formPanelFieldset',
    
    
                    items : [ {
    
    
                    } ]
                } ]
            } ],
        }
    
    
    });
    The problem I am having is that the map will initialize on the current location as expected, but after moving or scrolling the map it re-centers to a lat/long close to myCurrentLocation, but not exact.

    If I set useCurrentLocation to false the magic re-centering goes away, but the map is centered in Cali.

    Please let me know if this is something you have seen or heard of before and if you know a fix for it!

    Hopefully I have provided enough info, if not let me know!

    Thank you so much.

    bwags

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,533
    Vote Rating
    871
    Answers
    3565
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Is this due to the geolocation updating?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Feb 2012
    Location
    Illinois
    Posts
    93
    Vote Rating
    2
    bwags is on a distinguished road

      0  

    Default


    No, I'm running this from my desktop in a Chrome browser.

    I guess something that might be relevant and should have been in the original post:

    "Resource interpreted as Image but transferred with MIME type text/html: "http://maps.googleapis.com/maps/gen_204?......"

    But I did find some documentation online about the 'gen_204' issues and that they were okay to ignore.

    The re-centering only occurs after I zoom on the map or drag to look at something else.

    Setting useCurrentLocation : false fixes it.

    ...Thanks for the lightning fast response!!!

    bwags

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,533
    Vote Rating
    871
    Answers
    3565
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You will always see those messages in the console, they are just because of how the google maps load the tiles.

    I asked about the autoUpdate as the Geolocation can poll for your location and it can move depending on the returned location. Remember, GPS isn't 100% accurate, you said close but not quite.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  5. #5
    Sencha User
    Join Date
    Feb 2012
    Location
    Illinois
    Posts
    93
    Vote Rating
    2
    bwags is on a distinguished road

      0  

    Default


    Ahh...I think maybe I'm using the 'useCurrentLocation' incorrectly then. I would expect that a user scrolling to something on the map would override useCurrentLocation so that they could look at things nearby w/out having the map re-center on their current location. However, in a situation like driving a car I see how having the map recenter you constantly would be desired.

    I think what I'm looking for is something like Ext.Map.setMapCenter(lat, lon) with the lat lon pulled from current location.

    If that sounds way off please let me know .

    Thanks again!

Thread Participants: 1