1. #1
    Sencha User
    Join Date
    Sep 2011
    Posts
    5
    Vote Rating
    0
    umarani is on a distinguished road

      0  

    Default Map and Geo Location

    Map and Geo Location


    Hi ,
    I am new to sencha and currently working on Rendering the user's current location and showing it in the google map with a marker.. I need a simple example.. i got some examples which works fine in the web browser but not in the device.

    Thanks in advance.
    Uma

  2. #2
    Sencha Premium Member
    Join Date
    May 2008
    Location
    Pasadena, California
    Posts
    172
    Vote Rating
    2
    NickT is on a distinguished road

      0  

    Default


    numerous adjustments can be made to change the behavior and visual smoothness however here is a basic example ...

    you may have established your current position prior to the rendering of the map itself, in which case you can provide the current position as the center property of the mapOptions. I have determined it on map render on delay of a few seconds for demonstration purposes.... as you can see, there is an ability for the ext map to useCurrentPosition. This example is doing that manually, and dropping the marker simultaneously...

    Code:
    {                        xtype: 'map',
                            mapOptions: {
                                mapTypeId: google.maps.MapTypeId.ROADMAP
                            },
                            listeners:{
                                'maprender': function(extMap, googleMap) {
                                    var task = new Ext.util.DelayedTask(function() {
                                        if (navigator.geolocation) {
                                            navigator.geolocation.getCurrentPosition(function(position) {
                                                        console.log('marking current location...');
                                                        var currentLocation = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
                                                        googleMap.setCenter(currentLocation);
                                                        var marker = new google.maps.Marker({
                                                            animation: google.maps.Animation.DROP,
                                                            map: googleMap,
                                                            position: currentLocation
                                                        });
                                                    }, function() {
                                                        console.log('could not obtain geolocation');
                                                    });
                                        }
                                    }, googleMap);
                                    task.delay(3000);
                                }
                            },
                            useCurrentLocation: false
                        }

  3. #3
    Sencha User
    Join Date
    Sep 2011
    Posts
    5
    Vote Rating
    0
    umarani is on a distinguished road

      0  

    Default


    Hi thanks for the help. i now get this error : Uncaught ReferenceError: google is not defined at ..

  4. #4
    Sencha User
    Join Date
    Sep 2011
    Location
    Sallanches, France
    Posts
    371
    Vote Rating
    1
    myput is on a distinguished road

      0  

    Default


    Hi, try to add:
    Code:
    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
    in your index.html

  5. #5
    Sencha User
    Join Date
    Sep 2011
    Posts
    5
    Vote Rating
    0
    umarani is on a distinguished road

      0  

    Default


    hi , i have already added that in my html. and also the map doesn't shows my current location instead it shows the default view Los Altos Hills , Mountain View , so and so

  6. #6
    Sencha User
    Join Date
    Sep 2011
    Posts
    5
    Vote Rating
    0
    umarani is on a distinguished road

      0  

    Default


    this is what i have done in my js file.

    Code:
    Ext.setup({
        tabletStartupScreen: 'tablet_startup.png',
        phoneStartupScreen: 'phone_startup.png',
        icon: 'icon.png',
        glossOnIcon: false,
        onReady: function() {
     
            
        new Ext.Panel({
                id: 'sample',
                fullscreen: true,
                dockedItems:[{xtype:'toolbar',title:'Map Test'}],
                items:[
    					{
    						xtype: 'map',
                            mapOptions: {
                                		mapTypeId: google.maps.MapTypeId.ROADMAP
                            			},
                            listeners:{
                                		'maprender': function(extMap, googleMap) 
                                						{
                                   		 					var task = new Ext.util.DelayedTask(function() {
                                       						if (navigator.geolocation) 
                                       						{
                                            					navigator.geolocation.getCurrentPosition(function(position) {
                                                        				console.log('marking current location...');
                                                        				var currentLocation = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
                                                        				googleMap.setCenter(currentLocation);
                                                       					var marker = new google.maps.Marker({
                                                            				animation: google.maps.Animation.DROP,
                                                            				map: googleMap,
                                                            				position: currentLocation	});
                                                    				}, function() {
                                                        				console.log('could not obtain geolocation');
                                                   						 });
                                        					}
                                    						}, googleMap);
                                    						task.delay(3000);
                                						}
                            		},
                            useCurrentLocation: true
                        }]
    		});
    	}
    });

  7. #7
    Sencha User
    Join Date
    Sep 2011
    Location
    Sallanches, France
    Posts
    371
    Vote Rating
    1
    myput is on a distinguished road

      0  

    Default


    Yes for that,

    you must set your default params position or center to your current position.

  8. #8
    Sencha User
    Join Date
    Jan 2012
    Posts
    3
    Vote Rating
    0
    pratiksha is on a distinguished road

      0  

    Default I have the Same problem.

    I have the Same problem.


    The map is showing United States,Sunnywale mountian view instead of my current location. Help me regarding this prob Please !!

  9. #9
    Sencha User
    Join Date
    Jan 2012
    Posts
    3
    Vote Rating
    0
    pratiksha is on a distinguished road

      0  

    Default And also

    And also


    I din't get what to set default params position or center to your current location. Please explain

  10. #10
    Sencha User wilzdezign's Avatar
    Join Date
    Jul 2011
    Location
    WA
    Posts
    65
    Vote Rating
    0
    wilzdezign is on a distinguished road

      0  

    Post


    For example setting the center location on the map:

    Code:
    var centerp = new google.maps.LatLng(48.006370,-122.20383);
    
    var LocationsPanel = new Ext.Map({
        id: 'panel-locations',
        title: 'Location',
        iconCls: 'locate',
        
        useCurrentLocation: false,
        
        mapOptions: {
            zoom: 16,
            center: centerp,
            navigationControlOptions: {
                style: google.maps.NavigationControlStyle.DEFAULT
            }
        }
    });

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi