This repository has been archived on 2025-07-13. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
open-heraklion-bus/modules/map.php

17 lines
789 B
PHP
Raw Normal View History

<link rel="stylesheet" href="openlayers/ol.css" />
<script src="openlayers/ol.js"></script>
<?php
function ShowMap($lat,$lon){
2015-07-17 19:57:44 +03:00
echo '<div style="display:none;"><div id="marker" style="width:10px;height:10px;border-radius:50%;background-color:#ff0000;opacity:0.6;"></div></div>';
2015-07-19 11:54:17 +03:00
echo '<div id="mymap" style="width:300px;height:300px;overflow:hidden;"></div>';
echo '<script>';
echo 'var pos = new ol.proj.fromLonLat([' . $lon . ', ' . $lat . ']);';
2015-07-19 11:54:17 +03:00
echo 'var map = new ol.Map({target:"mymap"});';
echo 'map.setView(new ol.View({center: pos, zoom: 13}));';
echo 'map.addLayer(new ol.layer.Tile({source: new ol.source.OSM()}));';
echo 'map.addOverlay(new ol.Overlay({position: pos, element: document.getElementById("marker")}));';
echo '</script>';
}
?>