PDA

View Full Version : GeoLocation/Google map error



mkariti
10 Sep 2011, 9:37 PM
Hi there,
For some reason when Im uploading Google map to the server I get this error: 'got geo error' .
Does anyone know why this works on my local server but not on the remote server?
I know its a long shot but thought I better ask.
Cheers
mkariti

bharatn
10 Sep 2011, 9:39 PM
mkariti,

Please post some details with code to get meaningful responses from the community.

mkariti
10 Sep 2011, 9:48 PM
Hi bharatn,
Here is my code.
Many thanks


<script type="text/javascript">
Ext.setup({
icon: 'candle.png',
glossOnIcon:false,
onReady: function () {

function createMarker(center) {
//debugger;
store.proxy.url = 'http://www.xxxxx.com/mkariti/GetXMLParams.ashx?' + 'latitude=' + center.Qa + '&longitude=' + center.Pa + '&date=' + '9/9' + '&dst=1' + '&timezone=99' + '';
store.load({
callback: function (records) {
debugger;
var html = "<div id='bodyContent'>Friday the " + records[0].data.Coming_Friday + "<br />Sunset Time is:" + records[0].data.sunset + "<br/>Your Location is:" + center.lat() + "/" + center.lng() + "<br/>" + "Candle Lighting Times for Your Location is: " + records[0].data.candle_lighting_times + "<br />Your TimeZone is: " + records[0].data.timezone + "</div>";

var marker = new google.maps.Marker({
map: map.map,
position: center,
clickable: true,
draggable: true

});
var infowindow = new google.maps.InfoWindow({
content: html
});
google.maps.event.addListener(marker, 'click', function () {
infowindow = new google.maps.InfoWindow({
content: html
})
infowindow.open(map.map, marker);
});
infowindow.open(map, marker);
}
});
}

var center;
var getGoogleObject;
var map = new Ext.Map({
mapOptions: {
zoom: 10
},
geo: new Ext.util.GeoLocation({
autoUpdate: false,
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 });
createMarker(center);
},
locationerror: function (geo) {
alert('got geo error');
}
}
})
});

Ext.regModel('Sun', {
fields: ['timezone', 'sunset', 'civil', 'candle_lighting_times', 'Coming_Friday']
});

var store = new Ext.data.Store({
model: 'Sun',
proxy: {
type: 'ajax',
url: '',
reader: {
type: 'xml',
record: 'sun'
},
autoLoad: true
}
});
var panel = new Ext.Panel({
fullscreen: true,
layout: 'fit',
items: map,
dockedItems: {
dock: 'top',
xtype: 'toolbar',
ui: 'light',
layout: {
pack: 'center'
},
items: [
{
text: 'Get time',
handler: function () {
alert(center.lat() + ',' + center.lng());
}
}]
}
});
}
});

</script>


Please note the following:
1. For the Ext.data.Store URL, Im defining it under the createmarker function
2. Im calling an ashx file rather than XML file - works on my local and not on remote server. However, to rule out this I did use an XML file which gave me the same error.
many thanks
mkariti

umarani
30 Sep 2011, 3:16 AM
hi,
am new to sencha and currently trying to get current location and displaying in the google map. i tried many examples i got from net but nothing seems to work well.. can some one help me out.