Page 1 of 1

Getting markers from the DB

Posted: Wed May 07, 2014 7:49 am
by Deon

Hi

I am using your tutorial "Using the Google Maps API" to add markers from the collection to the google map.

I have followed your instructions, but does not work. One thing you mention in the tutorial is to map the $ to the CreateDBLocations javascript with the READ service. The Read service does not render a $, so I used the query service.

I remember before you had a different tutorial on how to get data from the database to display as markers. Do you not have this tutorial anymore as it worked!


Getting markers from the DB

Posted: Wed May 07, 2014 8:45 am
by Evgene Karachevtsev

Hello,

Did you add appropriate javascript code to "CovertDBLocations" as it's stated in the tutorial with "AddJS" button? What error do you have in this case?


Getting markers from the DB

Posted: Wed May 07, 2014 9:28 am
by Deon

Yes, with one change. The location col in my db is spelt with a Cap L ie. Location. So I changes this line in the JScript

JSON.stringify(value.Location, convertAddress);

Error that is thrown

Uncaught TypeError: Cannot read property 'address_components' of undefined Slpash.js:153
Apperyio.DataSource.onSuccess Slpash.js:153
Apperyio.DataSource.$a.createClass.successHandler appery.js:91
Apperyio.DataSource.$a.createClass.responseDataHandler appery.js:94
proxy jquery-1.8.2.js:775
fire jquery-1.8.2.js:974
self.fireWith jquery-1.8.2.js:1082
done jquery-1.8.2.js:7788
callback


Getting markers from the DB

Posted: Wed May 07, 2014 9:32 am
by Deon

Why is it referring to the javascript of my splash page?????? This has nothing to do with the splash page


Getting markers from the DB

Posted: Wed May 07, 2014 9:36 am
by Deon

I killed the splash page now.....
Uncaught TypeError: Cannot read property 'address_components' of undefined SignIn.js:155
Apperyio.DataSource.onSuccess SignIn.js:155
Apperyio.DataSource.$a.createClass.successHandler appery.js:91
Apperyio.DataSource.$a.createClass.responseDataHandler appery.js:94
proxy jquery-1.8.2.js:775
fire jquery-1.8.2.js:974
self.fireWith jquery-1.8.2.js:1082
done jquery-1.8.2.js:7788
callback

Does not make sense


Getting markers from the DB

Posted: Wed May 07, 2014 9:49 am
by Deon

it seems the issue is with this code. Should there not be some reference to the google map which is called google_map??

var markerLatLng = new google.maps.LatLng(localStorage.getItem('markerLat'), localStorage.getItem('markerLng'));

var marker = new google.maps.Marker({
position: markerLatLng,
map: map,
title: data.results[0].address_components[0].long_name,
animation: google.maps.Animation.DROP
});

bounds.extend(markerLatLng);
map.fitBounds(bounds);


Getting markers from the DB

Posted: Wed May 07, 2014 9:53 am
by Deon

further test show that lat and long is not returned


Getting markers from the DB

Posted: Wed May 07, 2014 10:00 am
by Deon

I am using a query and not the Read service for this because there is no $ in the Read Response mappings (maybe should change your docs accordingly) However the Query works fine. Problem seems to be with this code.....

JSON.stringify(value.Location, convertAddress);

function convertAddress(key, value)
{
convert_address.execute({
'data' : {
'address' : value,
'sensor' : false
}
});
}


Getting markers from the DB

Posted: Wed May 07, 2014 10:11 am
by Deon

Found the problem. It is the address itself. It seems to be having problems recognizing addresses. But it is working. The Map seems to be caching data. Do you know how I can clear it? Is it the initialize command?


Getting markers from the DB

Posted: Wed May 07, 2014 7:28 pm
by Kateryna Grynko

Hi Deon,

Please try reloading map:pregoogle.maps.event.trigger(map, 'resize');/pre