How to show endpoint in maps by get? - javascript

2

I'm new to programming, and I'm developing an app from which I look for a list of taxis closer to my location through a website. But I'm having a hard time doing this.

List the active taxi drivers within a geographic rectangle Endpoint:

GET link

Parameters:

  • sw: South end, west end of the rectangle, in the "latitude, longitude" format. Ex: -23.612474, - 46.702746

  • ne: North extreme point, east end of the rectangle, in the format "latitude, longitude". Ex: -23.589548, - 46.673392

Example

Request:

GET link

I can only create an endpoint, but I do not know how to pull this service and put them on the map, for example:

var person = MapModule.createAnnotation({

    latitude: -23.474891,
    longitude: -46.526756,
    title: 'Você',
    subtitle: 'São Paulo, SP',
    pincolor: MapModule.ANNOTATION_RED,
    image:"/ui/images/buscador.png",
}); 

Could anyone help me with the line of codes for me to get the latidude and longitude of these taxis in this geographic rectangle ??? Thanks guys

    
asked by anonymous 20.11.2015 / 23:31

1 answer

1

Dude, take a look at jQuery's $ .getJSON (). I usually use it to tinker with APIs in general. It will make a request with this url and return a JSON with an array, where each index is a point. You can walk through this array with a for, wander around the JSON and for home index pick up the latitude and longitude keys and create an endpoint on the map.

I did something similar in a codepen a few months ago, I just changed the API from where I get the information, but overall it's pretty much what you need. Take a look, it may help you: link

Thanks

    
21.11.2015 / 06:23