umama fakher
Posts: 0
Joined: Fri May 22, 2015 4:26 pm

adding-multiple-location-points-on-google-map-with-appery-io-backend-services

Geolocation working when GPS is enabled on android device and not working when it is disabled. Is there a way to prompt user to enable their GPS location if it is disabled. This problem is only on Android and in iOS it is working perfect that is if GPS is off it prompt user to turn it on/off. It will be great to hear from Appery team soon :) !!

Leo7626665
Posts: 0
Joined: Tue Jul 07, 2015 7:57 am

adding-multiple-location-points-on-google-map-with-appery-io-backend-services

Hi LuisMa,

I was hoping you could help me with a similar issue?

My DB photos have one column for geopoints rather than one for Lat and one for Lng.

On my map component I am able to display, as marker, user location but I would also like to display the location of my photos (different marker icon) stored in DB.

What is the best way to do this?

Thanks!

Vamsikrishna Balabhadra
Posts: 0
Joined: Mon Aug 31, 2015 8:50 am

adding-multiple-location-points-on-google-map-with-appery-io-backend-services

hi kateryna,

i am using mysql databse,in my database contains lat and long values,by using these databse values,how can i show locations in google map..

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

adding-multiple-location-points-on-google-map-with-appery-io-backend-services

Hello Vamsikrishna,

Unfortunately we don't have ready solution for this task with external db.

LG
Posts: 0
Joined: Tue Sep 29, 2015 11:07 am

adding-multiple-location-points-on-google-map-with-appery-io-backend-services

Hi LuisMa,
I am doing something similar, but unable to drop all the markers. It only shows the last marker in the array. Any thought on this? Anybody encountered this?

Vinny B
Posts: 0
Joined: Fri Aug 22, 2014 2:22 pm

adding-multiple-location-points-on-google-map-with-appery-io-backend-services

Hello Hope this help... There is a learning curve with Appery, probably a little bit more then with other programs but you will find that you are able to do so much more. The other programs are basically web pages were Appery allows you to add allot more functions. I tried them ALL and this is the best and worth the money and time it took me. It defiantly will take more then a month to learn how to do some more advanced functions like looping through an array.

I suggest you save the database to a local storage. In Models and Storage set it up like. This:

Image

Then map your database to it.

Then on page load or a button run this Javascript code

//Name of LOCALSTORAGE
var list_location = localStorage.getItem('mysqlHospitalsArray');
var image = '../img/h_white_circle.png';
var obj = JSON.parse(list_location);
var coordsArray = obj;
var marker;
//NAME YOUR MAP (googlemap_6)
var map = Appery("googlemap_6").options.mapElement.gmap('get', 'map');

var CreateMarker = function(coordsArray, i){
var marker = new MarkerWithLabel({
//Make sure your Lat and Lon or spelled same as below
position: new google.maps.LatLng( coordsArray.Lat, coordsArray.Lon ),
icon: image,
//NAME is the Name you want to appear on the map (
labelContent: coordsArray.Name,
map: map,

Code: Select all

labelAnchor: new google.maps.Point(35, 0), 
labelClass: "mapHospitals", // the CSS class for the label 
labelStyle: {opacity: 0.75},  

 clickable: true    

});
var infowindow = new google.maps.InfoWindow({content: coordsArray.Name});
google.maps.event.addListener(marker, 'click', function() {
//Ads info Window
//infowindow.open(map,marker);
window.open('http://maps.apple.com/?daddr=' + (coordsArray.Lat) + "," + (coordsArray.Lon),'_system', 'location=yes');
});

};
for (var i = 0, j = coordsArray.length; i < j; i++)
CreateMarker(coordsArray, i);

Vinny B
Posts: 0
Joined: Fri Aug 22, 2014 2:22 pm

adding-multiple-location-points-on-google-map-with-appery-io-backend-services

If you put the below code in a button and name your map ( googlemap_6 )
You will be able to test the script. If it works then you just need to figure out how to map your database to localStorage and use the above code to get that info. (difference in the codes is the parse.

//var list_location = localStorage.getItem('mysqlHospitalsArray');

var coordsArray = [{"Name":"Empire State Building","Lat":"40.748558","Lon":"-73.985664"},{"Name":"WTC Site","Lat":"40.711518","Lon":"-74.013164"}];

var image = '../img/h_white_circle.png';
//var obj = JSON.parse(list_location);
//var coordsArray = obj;
var marker;
var map = Appery("googlemap_6").options.mapElement.gmap('get', 'map');

var CreateMarker = function(coordsArray, i){
var marker = new MarkerWithLabel({
position: new google.maps.LatLng( coordsArray.Lat, coordsArray.Lon ),
icon: image,

Code: Select all

labelContent: coordsArray[i].Name, 
map: map, 

labelAnchor: new google.maps.Point(35, 0), 
labelClass: "mapHospitals", // the CSS class for the label 
labelStyle: {opacity: 0.75},  

 clickable: true    

});
var infowindow = new google.maps.InfoWindow({content: coordsArray.Name});
google.maps.event.addListener(marker, 'click', function() {
//Ads info Window
//infowindow.open(map,marker);
window.open('http://maps.apple.com/?daddr=' + (coordsArray.Lat) + "," + (coordsArray.Lon),'_system', 'location=yes');
});

};
for (var i = 0, j = coordsArray.length; i < j; i++)
CreateMarker(coordsArray, i);

Example working in appery tester

Image

frankie
Posts: 0
Joined: Sat Oct 05, 2019 4:48 am

adding-multiple-location-points-on-google-map-with-appery-io-backend-services

Tommy, it's been years since your question but I could really use a hand. If you don't mind sharing what code worked for you to place multiple markers on google maps from saved Lat and Lng previously stored in a DB? I am trying to adjust the same tutorial you were; placing multiple markers in DB without address conversion and then creating a direction line.

Return to “Issues”