PDA

View Full Version : Markers and Google maps



Simonhayre
7 Jul 2010, 4:12 AM
Can someone point me in the right direction, I can't get any markers to show, I've tried thousands of different ways. Please help.



var myLatlng = new google.maps.LatLng(lat,lng);

var marker = new google.maps.Marker({
position: myLatlng,
title:"Hello world"
});

var myOptions = {
zoom: 13,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}


var map = new Ext.Map(
{
fullscreen:true,
mapOptions: myOptions
});

marker.setMap(map);

var pnl = new Ext.Panel({
fullscreen: true,
items: [map]
});

evant
7 Jul 2010, 4:36 AM
There's sample code for this in the example, eg:



Ext.setup({
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
icon: 'icon.png',
glossOnIcon: false,
onReady: function() {
var toolbar = new Ext.Toolbar({
dock: 'top',
xtype: 'toolbar',
title: 'Map'
});

var position = new google.maps.LatLng(37.44885,-122.158592);

var mapdemo = new Ext.Map({
center: position
});

new Ext.Panel({
fullscreen: true,
dockedItems: [toolbar],
items: [mapdemo]
});

// The following is accomplished with the Google Map API

var infowindow = new google.maps.InfoWindow({
content: 'Ext JS'
})

/*
var marker = new google.maps.Marker({
position: position,
map: mapdemo.map
});
*/

var myMarker = new google.maps.Marker({
position: new google.maps.LatLng(30.44885,-111.158592),
map: mapdemo.map
});
}
});

reminder
7 Jul 2010, 8:43 AM
hello

replace in ext-touch-debug.js at line 15793 to this

Ext.applyIf(this.mapOptions, {
center: data.center,
zoom: data.zoom,
mapTypeId: data.mapTypeId
});

and find the same compressed stuff in ext-touch.js

regards

Simonhayre
7 Jul 2010, 12:21 PM
There's sample code for this in the example, eg:



Ext.setup({
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
icon: 'icon.png',
glossOnIcon: false,
onReady: function() {
var toolbar = new Ext.Toolbar({
dock: 'top',
xtype: 'toolbar',
title: 'Map'
});

var position = new google.maps.LatLng(37.44885,-122.158592);

var mapdemo = new Ext.Map({
center: position
});

new Ext.Panel({
fullscreen: true,
dockedItems: [toolbar],
items: [mapdemo]
});

// The following is accomplished with the Google Map API

var infowindow = new google.maps.InfoWindow({
content: 'Ext JS'
})

/*
var marker = new google.maps.Marker({
position: position,
map: mapdemo.map
});
*/

var myMarker = new google.maps.Marker({
position: new google.maps.LatLng(30.44885,-111.158592),
map: mapdemo.map
});
}
});


Cheers for that, I had missed an object reference. all working now.