Results 1 to 9 of 9

Thread: Map is not showing my current location

  1. #1

    Default Map is not showing my current location

    Dear all,

    I am try to create an application with a map showing my current location - the map appears but it is not showing my current location, please help

    <code>
    var
    map;JobDeals.views.jobslistToolBar3 = new Ext.Toolbar({id: 'jobslistToolbar3',title: 'Job Map',items: [{text: 'Back',ui: 'back',handler: function () {JobDeals.views.viewport.setActiveItem('viewjobslist',{ type: 'slide', direction: 'left'})}}]});map = new Ext.Map({title: 'Map',iconCls: 'maps',useCurrentLocation: true,mapOptions: {zoom: 110}});JobDeals.views.JobsMapList = Ext.extend(Ext.Panel,{id:'viewjobmaplist',fullscreen:true,layout:'fit',dockedItems: [JobDeals.views.jobslistToolBar3],items:map});
    Ext.reg('jobsmap',JobDeals.views.JobsMapList)
    </code>

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,450

    Default

    You shouldn't use <code> tags, it's [code].

    Does it prompt you to allow it to get your location?
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Fullstack Engineer
    ________________
    Modus Create is based on the model of an open source team. We’re a remote, global team of experts in our field. To find out more about the work we do, head over to our website.

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3

    Default

    No popup comes up, I tested it in chrome + on my galaxy tab.

  4. #4
    Sencha User
    Join Date
    Aug 2011
    Location
    Mumbai, India
    Posts
    120

    Default

    Add this to your map after the your mapoptions :

    Code:
    geo:new Ext.util.GeoLocation({                  autoUpdate:true,
                      maximumAge: 0,
                      timeout:2000,
                      listeners:{
                        locationupdate: function(geo) {
                          center = new google.maps.LatLng(geo.latitude, geo.longitude);
                          if (map.rendered)
                            map.update(center)
                          else
                            map.on('activate', map.onUpdate, map, {single: true, data: center});
                        },
                         locationerror: function (   geo,
                                                    bTimeout, 
                                                    bPermissionDenied, 
                                                    bLocationUnavailable, 
                                                    message) {
                            if(bLocationUnavailable){
                                alert('Your Current Location is Unavailable on this device');
                            }
                            else if (bPermissionDenied){
                                alert('Location capabilities have been disabled on this device.');
                            }      
                         }
                      }
                 })
    Hope this helps Cheers

  5. #5

    Default

    I tried and received the message "Your Current Location is Unavailable on this device". Tested in chrome and with my android tab. below the complete site code:

    Code:
    var
    map;JobDeals.views.jobslistToolBar3 = new Ext.Toolbar({id: 'jobslistToolbar3',title: 'Job Map',items: [{text: 'Back',ui: 'back',handler: function () {JobDeals.views.viewport.setActiveItem('viewjobslist',{ type: 'slide', direction: 'left'})}}]});map = new Ext.Map({title: 'Map',iconCls: 'maps',useCurrentLocation: true,mapOptions: {zoom: 12},geo:new Ext.util.GeoLocation({ autoUpdate:true,maximumAge: 0,timeout:2000,listeners:{locationupdate: function(geo) {center = new google.maps.LatLng(geo.latitude, geo.longitude);if (map.rendered)map.update(center);else
    map.on(
    'activate', map.onUpdate, map, {single: true, data: center});},locationerror: function ( geo,bTimeout, bPermissionDenied, bLocationUnavailable, message) {if(bLocationUnavailable){alert('Your Current Location is Unavailable on this device');}elseif (bPermissionDenied){alert('Location capabilities have been disabled on this device.');} }}})});JobDeals.views.JobsMapList = Ext.extend(Ext.Panel,{id:'viewjobmaplist',fullscreen:true,layout:'fit',dockedItems: [JobDeals.views.jobslistToolBar3],items:map});
    Ext.reg('jobsmap',JobDeals.views.JobsMapList)

  6. #6
    Sencha User
    Join Date
    Aug 2011
    Location
    Mumbai, India
    Posts
    120

    Default

    If you're trying it on the browser on ur desktop it won't work. The code I gave you doesnt work with the IP address.

    From the code you've pasted.... You really need to read what ppl post above especially when you ask for help. Add the code from my earlier post to ur Map Object after the mapOptions part.

    Another way is inserting the currentLocation in the xtype itself. eg.
    Code:
    {
         xtype : 'map',
         useCurrentLocation : true, 
         id : 'mymap;
    }

  7. #7

    Default

    sorry I am a total newbie - i am not getting your point, did I inserted your code in the wrong place? I put it right after mapoptions. Why will it not work in the browser?

    Thanks for your patience

  8. #8

    Default

    I tried it also through my pad but it is not working i still get Los Altos Hills

  9. #9
    Sencha User
    Join Date
    Jan 2016
    Location
    Brazil
    Posts
    138

    Default

    this, or a very similar error was reported here: https://www.sencha.com/forum/showthread.php?303498

    I could find a work around this problem and maybe someone finding this thread may like to see the outcome on the other (although that is focused on ExtJS 6/modern).
    Object.NET
    Frameworks and Tools for .NET Developers
    --------------------------------------------------
    Ext.NET - Ext JS for ASP.NET - Examples | Twitter
    Bridge.NET - Write C#. Run JavaScript! - Live | Twitter
    --------------------------------------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •