Page 3 of 6

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

Posted: Mon May 12, 2014 11:59 am
by romo

This My DB
Image

my service and mapping:
Image

result:
Image

Uncaught TypeError: Cannot read property 'length' of undefined!.
Stuck!
anybody can help.


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

Posted: Tue May 13, 2014 2:43 am
by Yurii Orishchuk

Hi Romo.

In code you have an error.

Replace line of code:

pre
code

var coordsArray = obj.coordinate;

/code
/pre

With following line of code:

pre
code

var coordsArray = data;

/code
/pre

See details on screen shot: http://prntscr.com/3iqjn0/direct

Regards.


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

Posted: Tue May 13, 2014 6:04 am
by romo

Dear Yurii.

Many thanx.
Image

Done!


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

Posted: Fri Jul 11, 2014 7:59 am
by adith visnu

hi all,
i just wanna ask for line : var coordsArray = obj.coordinate;
for what that line ? and could you explain that ?
im so sorry, i'm newbie here


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

Posted: Fri Jul 11, 2014 8:47 am
by adith visnu

its done :)


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

Posted: Mon Sep 08, 2014 8:21 am
by LuisMa Suárez Gutiérrez

ok this solved this same issue for me. it works! thanks Katya

only question : whats the difference between using
Appery("map_name").gmap
and this :
var map = Appery("googlemap_1").options.mapElement.gmap('get', 'map');
I used the first option to place markers. the second is Yuri's code i dopnt understand the difference.

s


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

Posted: Mon Sep 08, 2014 8:43 am
by LuisMa Suárez Gutiérrez

why can't i use this line with a database Geopoint?
'pin_place' contains a Geopoint mapped from a database.

var markerLatLng = new google.maps.LatLng(localStorage.getItem('pin_place'));

i need to use a seperate 'long' and 'lat' values and it works that way, but shouldn't it work with geopoints too?
Image


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

Posted: Mon Sep 08, 2014 10:23 pm
by Yurii Orishchuk

Hi LuisMa,

  1. When you store object to LSV you need store there JSON string.

    So click "Add js" and populate JS editor with following code: http://prntscr.com/4l0ji2/direct

    pre

    return = JSON.stringify(value);

    /pre

    2 Then when you need to use this object you can parse this string(stored in LSV) to origin JS object. Here is code:

    pre

    var jsonString = localStorage.getItem('pin_place');

    var originObject = JSON.parse(jsonString);

    //here you can access origin object in accordance to your needs:
    console.log("first item = " + originObject[0]);
    console.log("second item = " + originObject[1]);

    /pre

    Regards.


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

Posted: Mon Sep 08, 2014 11:22 pm
by LuisMa Suárez Gutiérrez

ok thank you, that makes sense.
but tried it , and it seems the Object never gets anything data from the LSV. I've attached an SS with :
-the DB showing the Geopoints,
-the console output
-the expressions watch
-and the code i inserted

also, I added this JS to the 'pin_place' mapping: "return JSON.stringify(value);"

so, supposing this code is correct, I would still need to do this :

codenew google.maps.LatLng(originObject[0],originObject[1]);/code

Instead of just:

codenew google.maps.LatLng( originObject);/code

right?

not much use for a geopoint i seems. do you recomend this approach then ? so far it has worked for me :

codevar markerLatLng=new google.maps.LatLng(

localStorage.getItem('lon') , localStorage.getItem('lat')

); /code

Image


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

Posted: Wed Sep 10, 2014 12:26 am
by Yurii Orishchuk

Hi LuisMa,

Here is code i've gave you:

pre

var jsonString = localStorage.getItem('pin_place');
var originObject = JSON.parse(jsonString);
//here you can access origin object in accordance to your needs:
console.log("first item = " + originObject[0]);
console.log("second item = " + originObject[1]);

/pre

So here is some debug code that's print information into browser console.
Could you be pleased to take a look into this console and find what this code logs?

There should be something like:

"rirst item = 45.2123"
"second item = 12.234"

pre

so, supposing this code is correct, I would still need to do this :

new google.maps.LatLng(originObject[0],originObject[1]);

/pre

Yes - it seem to be correct code. But you need to check whether you have correct values debug code.

Regards.