Mario Acevedo
Posts: 0
Joined: Sun Feb 16, 2014 10:17 pm

Beginner with GEO LOCATION

Hi,
My name in Mario, and I'm new in appery.io I'm building an App with this features.
I have a list od POI and I want to place them on a map each POI has a latitude and longitude and a picyure od POI. I want to place them on a Google map and to create a search box where my users can type the for example pharmacy and the App tell him the near pharmacy to him.

I see a lot of appery video such as the AT&T geolocation example.

Can I get some help I'm a Pro user and Iwant to know if there is some example that I could use and upload and start from there.

Please give me some help.

Best Regards.

Mario

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Beginner with GEO LOCATION

Hi Mario -

I encourage you to make app from this tutorial by yourself, it will help you better understand how to work with Google Map API:
:: http://docs.appery.io/tutorials/addin...

If you have specific questions do not hesitate to ask, we will help.

Mario Acevedo
Posts: 0
Joined: Sun Feb 16, 2014 10:17 pm

Beginner with GEO LOCATION

Hi,
Illya

Thanks for the response It helps me a lot. I'm finishing the creation of that App test with the tutorial.
I hace a question, on the tutorial I've see that the DB stores locarions (addresses, places) but in my case I have the exact longitud and latitude of the POI how can I setup it this way so I could store in the DB the latitude and longitude and then see the multiple POI in my map.

Regars.

Mario Acevedo
Posts: 0
Joined: Sun Feb 16, 2014 10:17 pm

Beginner with GEO LOCATION

Hi,
All

I was finishing the tutorial of "Adding multiple location points on Google Maps via backend services" and on the step where I have to define the parameters in Request tab I setup default value to sensor to true and I test It and get this error.

{

Code: Select all

"error_message" : "The 'sensor' parameter specified in the request must be set to either 'true' or 'false'.", 

"results" : [ 

 ], 

"status" : "REQUEST_DENIED" 

}

Don't know what is wrong.
Image Image

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

Beginner with GEO LOCATION

Hi Mario,

Please change 'post' method to 'get'.

Mario Acevedo6670979
Posts: 0
Joined: Mon Feb 17, 2014 6:11 pm

Beginner with GEO LOCATION

Hi,
Katya

Thanks for the answer I'm going to change the method to get and see if that works.

Related to my other question could you please help me.
I have a question, on the tutorial I've see that the DB stores locations (addresses, places) but in my case I have the exact longitud and latitude of the POI how can I setup it this way so I could store in the DB the latitude and longitude and then see the multiple POI in my map.

Regards

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

Beginner with GEO LOCATION

Hi Mario,

This can be done in this way:

  1. Add new collection (or use already existed) with collumns "lat" and "long"

  2. Create Database Service with method list.

  3. Create dataservice called getCoordList with service described in previous step.

  4. Go to mapping of getCoordList. Create javascript "ProcessCoordsList" and map answer from getCoordList to this Javascript.

  5. Click edit JS, paste the next code:
    pre
    locationHelper.aLocations.push([parseFloat(value.lat), parseFloat(value.long)]);
    DrawMapPoints();/pre

    Create New Javascript asset with the following code:

    pre
    function DrawMapPoints(data){
    var maxLatitude = -90,
    minLatitude = 90,
    maxLongitude = -180,
    minLongitude = 180;
    for (i = 0; i < locationHelper&#46;aLocations&#46;length; i++) {
    maxLatitude = locationHelper&#46;aLocations[0] maxLatitude ? locationHelper&#46;aLocations[0] : maxLatitude;
    minLatitude = locationHelper&#46;aLocations[0] < minLatitude ? locationHelper&#46;aLocations[0] : minLatitude;
    maxLongitude = locationHelper&#46;aLocations[1] maxLongitude ? locationHelper&#46;aLocations[1] : maxLongitude;
    minLongitude = locationHelper&#46;aLocations[1] < minLongitude ? locationHelper&#46;aLocations[1] : minLongitude;
    }
    var map = new google&#46;maps&#46;Map(document&#46;getElementsByName("multiGoogleMap")[0], {
    zoom: 5,
    center: new google&#46;maps&#46;LatLng((maxLatitude + minLatitude) / 2, (maxLongitude + minLongitude) / 2),
    mapTypeId: google&#46;maps&#46;MapTypeId&#46;ROADMAP
    });
    var marker, i;
    for (i = 0; i < locationHelper&#46;aLocations&#46;length; i++) {
    marker = new google&#46;maps&#46;Marker({
    position: new google&#46;maps&#46;LatLng(locationHelper&#46;aLocations[0], locationHelper&#46;aLocations[1]),
    map: map
    });
    }

    var map = Appery('multiGoogleMap');
    map&#46;refresh();
    };/pre

  6. Invoke "getCoordList".

Nick Pitt
Posts: 0
Joined: Tue Feb 18, 2014 12:44 pm

Beginner with GEO LOCATION

Get method also brings up the error message.

"error_message" : "The 'sensor' parameter specified in the request must be set to either 'true' or 'false'.",

Code: Select all

"results" : [ 

 ], 

"status" : "REQUEST_DENIED" 

Is there anything else we can try.

Thanks

Nick

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Beginner with GEO LOCATION

Hello,

Lets try to untick "Header" in the "sensor" request parameter.

Return to “Issues”