Skip to content

Instantly share code, notes, and snippets.

@Avidid
Created July 29, 2013 18:16
Show Gist options
  • Select an option

  • Save Avidid/6106386 to your computer and use it in GitHub Desktop.

Select an option

Save Avidid/6106386 to your computer and use it in GitHub Desktop.
Display Nominatim search results as pois on openstreetmap
<?php if (!$results->error && $results->total != '0'): ?>
<?php $counter = 1 ;?>
<?php foreach ($results as &$result): ?>
park = new MQA.Poi({
lat:<?php echo $result->lat; ?>, lng:<?php echo $result->lon; ?>});
park.setRolloverContent('<?php echo $result->address->park;?>');
park.setInfoContentHTML('<?php echo $result->address->road;?>');
var icon=new MQA.Icon("http://open.mapquestapi.com/staticmap/geticon?uri=poi-bluegreen_3-<?php echo $counter++ ;?>.png",20,29);
park.setIcon(icon);
map.addShape(park);
<?php if ($result->lat && $result->lon): ?>
var parkdistanceOne={lat:<?php echo $latitude ;?>, lng:<?php echo $longitude ;?>};
var parkdistanceTwo={lat:<?php echo $result->lat; ?>, lng:<?php echo $result->lon; ?>};
document.getElementById('<?php echo $counter++ ;?>distance').innerHTML=MQA.Util.distanceBetween(parkdistanceOne,parkdistanceTwo,'m');
<?php endif; ?>
<?php endforeach; ?>
<?php unset($result); ?>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment