David7061102
Posts: 0
Joined: Sat Aug 23, 2014 2:00 am

Backend services for adding multiple map locations to map (with marker) from database.

My goal in using Appery.io is to display the user's gps location on a map, with a zoom of about 15, and display all the businesses listed in our MangoDB database in the general vicinity. It is very important that we also display the business name on the marker.

https://getsatisfaction.com/apperyio/... Image

I watched every mapping video with Appery's and Youtube. Read thru all the documentation on the Appery site. But still can't find the answer to one little problem. I'm using all the tools used for this solution: https://getsatisfaction.com/apperyio/...

Instead of me writing out the setup, I included screen shots.
Also note that I have created all the of the multi-location maps with much success but my goal here is straight from the db with or without local storage.

I think my problem might be with the db geo "loc[]" conversion (in brackets) to the service and map or with the timing of invoking the the service and adding markers.

I tried both the enabling with a "button on click" and service Success event with no success.

Under the gun here... I Appreciate any help you can offer.

Thanks

Code: Select all

[url=https://d2r1vs3d9006ap.cloudfront.net/s3_images/1090823/Screenshot-(62)-W700.jpg?1408758289][img]https://d2r1vs3d9006ap.cloudfront.net/s3_images/1090823/Screenshot-(62)-W700_inline.jpg?1408758289[/img] [/url]
Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Backend services for adding multiple map locations to map (with marker) from database.

Hello David,

Sorry for late reply. We'll reply as soon as have more information. This will take some time.

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Backend services for adding multiple map locations to map (with marker) from database.

David,

Please read here how to place multiple markers based on the data retrieved from the database.
http://devcenter.appery.io/tutorials/...

As for getting the latitude/latitude -- you can do a simple GET request to get all the data.

David7061102
Posts: 0
Joined: Sat Aug 23, 2014 2:00 am

Backend services for adding multiple map locations to map (with marker) from database.

Can you be a little more explicate.

I'm using the instructions from here with the following code.

https://getsatisfaction.com/apperyio/...
var response = JSON.stringify(data);

localStorage.setItem("latlng", response);
var latlng = localStorage.getItem('latlng');
var obj = JSON.parse(latlng);
var coordsArray = data;

var marker;
for (var i = 0, j = coordsArray.length; i < j; i++) {
marker = new google.maps.Marker({
position: new google.maps.LatLng( coordsArray.Lat, coordsArray.Lng ),
map: Appery("googlemap_3").gmap
});
}

I added this in the EVENTS on the DATA page. The mapping is in the above image.

Thanks. David

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Backend services for adding multiple map locations to map (with marker) from database.

Hi David,

Lets see variant with separate "lat" and "lng" fields:

I see following mistake:

in your DB you have "lat" and "lng" written with lower case. But in you code you have these fields with UpperCase. See details: http://prntscr.com/4guev3/direct

In you code:

pre

position: new google&#46;maps&#46;LatLng( coordsArray&#46;Lat, coordsArray&#46;Lng ),

/pre

So you need to use following code in accordance to your DB:

pre

position: new google&#46;maps&#46;LatLng( coordsArray&#46;lat, coordsArray&#46;lng ),

/pre

You need to add some console.log() debug message to print each "coordsArray" item.

Also if you can not manage to fix it please give us your app public link and describe steps to reproduce this problem.

Regards.

Return to “Issues”