Deon
Posts: 0
Joined: Sun Jun 30, 2013 6:00 am

Getting markers from the DB

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!

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Getting markers from the DB

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?

Deon
Posts: 0
Joined: Sun Jun 30, 2013 6:00 am

Getting markers from the DB

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

Deon
Posts: 0
Joined: Sun Jun 30, 2013 6:00 am

Getting markers from the DB

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

Deon
Posts: 0
Joined: Sun Jun 30, 2013 6:00 am

Getting markers from the DB

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

Deon
Posts: 0
Joined: Sun Jun 30, 2013 6:00 am

Getting markers from the DB

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);

Deon
Posts: 0
Joined: Sun Jun 30, 2013 6:00 am

Getting markers from the DB

further test show that lat and long is not returned

Deon
Posts: 0
Joined: Sun Jun 30, 2013 6:00 am

Getting markers from the DB

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
}
});
}

Deon
Posts: 0
Joined: Sun Jun 30, 2013 6:00 am

Getting markers from the DB

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?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Getting markers from the DB

Hi Deon,

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

Return to “Issues”