Page 1 of 1

Geocoding tutorial

Posted: Wed Apr 08, 2015 3:32 pm
by RobertJay

Is the server-side code in the current tutorial up-to-date in terms of the fixes Appery suggested to solve problems mentioned in earlier threads? Thank you.


Geocoding tutorial

Posted: Wed Apr 08, 2015 3:39 pm
by Illya Stepanov

Hi Robert -

Could you please specify the exact tutorial that you mean.


Geocoding tutorial

Posted: Wed Apr 08, 2015 3:41 pm
by RobertJay

Geocoding tutorial

Posted: Wed Apr 08, 2015 3:58 pm
by Illya Stepanov

This is our recently added version, so everything should be well.
Are you having some troubles with it?


Geocoding tutorial

Posted: Wed Apr 08, 2015 5:05 pm
by RobertJay

Thanks Illa.

First, let me say that I've found this tutorial indispensable in learning both about geolocation functionality and the incredible value of server-side script.

Question: when I went to first copy your code into my server-side code, I noticed that your script already existed in my existing scripts - but I don't remember ever putting it there. Is it possible that appery pre-installed it - and that the version that was installed doesn't include subsequent changes made in the tutorial?

But in any case - and I'm sure it's something I'm (not) doing - when I run a test on the related service I keep getting the response:

{
"status":400,
"uri":"https://api.appery.io/rest/1/code/my key is here/exec",
"response":"Wrong parameters"
}

Question: I'm using what is called a db key for my request- is that what the code uses for db id?

I've modified your code so as to use latitude and longitude in my db, rather than getting it from Google. Other than that, I think I've followed the tutorial correctly.

Question: the latitude and longitude values in my db are strings - is their not being a number a possible reason for the problem? I ask, because the "try" in your code seems to require numbers. Should I use JS and convert my string to numbers?

Thanks again for your help.


Geocoding tutorial

Posted: Wed Apr 08, 2015 6:56 pm
by Miguel Navarro7469744

I like working with the javascript and to me this works the best:

function codeAddressAndMark(map, markerTitle, address,icon) {
geocoder = new google.maps.Geocoder();
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var location= results[0].geometry.location;
locationArray.push(location);
createMarker(map, markerTitle, location,icon);
} else {
alert('Geocode was not successful for the following reason: ' + status);
}
});
}


Geocoding tutorial

Posted: Wed Apr 08, 2015 7:22 pm
by RobertJay

Thank you Miguel - but I'm new at this and don't quite see how this ties in with my issue.


Geocoding tutorial

Posted: Fri Apr 10, 2015 8:47 am
by RobertJay

Update- please ignore questions-I believe I am getting them resolved.


Geocoding tutorial

Posted: Fri Apr 10, 2015 9:08 am
by Evgene Karachevtsev

Hello Robert,

Thank you for the update, glad it works!