標籤:round target new styles oct log type php source
php請求MySQL資料庫返回GeoJSON資料的實現方法請參見:
http://www.cnblogs.com/marost/p/6234514.html
OpenLayers【v3.19.1-dist】添加GeoJSON資料來源圖層
<!doctype html><html lang="en"> <head> <link rel=‘stylesheet‘ href=‘ol.css‘> <style> #map { height: 100%; width: 100%; } </style> <title>OpenLayers 3 example</title> <script src="ol.js" type="text/javascript"></script> </head> <body> <h1>My Map</h1> <div id="map"></div> <script type="text/javascript"> var raster = new ol.layer.Tile({ source: new ol.source.OSM() }); var vector = new ol.layer.Vector({ source: new ol.source.Vector({ url: ‘http://yourip/getPosition.php‘, format: new ol.format.GeoJSON() }) }); var map = new ol.Map({ layers: [raster, vector], target: ‘map‘, view: new ol.View({ center: [0, 0], zoom: 2 }) }); </script> </body></html>
OpenLayers添加點【php請求MySQL資料庫返回GeoJSON資料】