Created
July 29, 2013 18:16
-
-
Save Avidid/6106386 to your computer and use it in GitHub Desktop.
Display Nominatim search results as pois on openstreetmap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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