Find more Examples here

Near by Search (Map-API)

Version reduced to minimal set of HTML Read Example Description

Description

Request a list of tour ids inside a radius around a location with help of the method oa.api.requestIds().

<ul id="tourList">
</ul>
// nearBy search: location (center; lat/lng), radius (meters)
var request = {
    searchNearby : {
        location : {
            lat:47.547,
            lng:10.293},
        radius : 10000 }
};

// send request to Outdooractive Platform
oa.api.requestIds( request, callback );

// ids request callback
function callback( answer ) {

    // check wether the request was successfull
    if (answer.success) {

        // grab ids from answer object
        var ids = answer.data.ids;

        // find document element of unordered list
        var tourList = document.getElementById("tourList");

        // loop through the first 10 nearest tours found
	for(var i=0; i<ids.length && i<10; i++) {

	    // create a new list item for each loaded tour
            li = document.createElement("li");

	    // just write the tour id to the list
	    // use the Objects API to load tour data if needed
	    li.innerHTML = ids[i]

	    // append list item to unordered list
	    tourList.appendChild(li);
        }
        
    }
    
}