Новичок
Покинул форум
Сообщений всего: 1
Дата рег-ции: Март 2014
Помог: 0 раз(а)
|
Здравствуйте.
Я говорю по русски не очень хорошо,если что извините
Мне срочно нужна помощь.
вот,есть у меня такой код,который показывает полигон на карте гугл.
HTML+Js код.
CODE ( html):
скопировать код в буфер обмена
<!DOCTYPE html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> <meta charset="utf-8"> <title>Polygon Arrays</title> <style> html, body, #map-canvas { height: 100%; margin: 0px; padding: 0px } </style> <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script> <script> // This example creates a simple polygon representing the Bermuda Triangle. // When the user clicks on the polygon an info window opens, showing // information about the polygon's coordinates. var map; var infoWindow; function initialize() { var mapOptions = { zoom: 5, center: new google.maps.LatLng(24.886436490787712, -70.2685546875), mapTypeId: google.maps.MapTypeId.TERRAIN }; var bermudaTriangle; map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions); // Define the LatLng coordinates for the polygon. var triangleCoords = [ new google.maps.LatLng(25.774252, -80.190262), new google.maps.LatLng(18.466465, -66.118292), new google.maps.LatLng(32.321384, -64.75737) ]; // Construct the polygon. bermudaTriangle = new google.maps.Polygon({ paths: triangleCoords, strokeColor: '#FF0000', strokeOpacity: 0.8, strokeWeight: 3, fillColor: '#FF0000', fillOpacity: 0.35 }); bermudaTriangle.setMap(map); // Add a listener for the click event. google.maps.event.addListener(bermudaTriangle, 'click', showArrays); infoWindow = new google.maps.InfoWindow(); } /** @this {google.maps.Polygon} */ function showArrays(event) { // Since this polygon has only one path, we can call getPath() // to return the MVCArray of LatLngs. var vertices = this.getPath(); var contentString = '<b>Bermuda Triangle polygon</b><br>' + 'Clicked location: <br>' + event.latLng.lat() + ',' + event.latLng.lng() + '<br>'; // Iterate over the vertices. for (var i =0; i < vertices.getLength(); i++) { var xy = vertices.getAt(i); contentString += '<br>' + 'Coordinate ' + i + ':<br>' + xy.lat() + ',' + xy.lng(); } // Replace the info window's content and position. infoWindow.setContent(contentString); infoWindow.setPosition(event.latLng); infoWindow.open(map); } google.maps.event.addDomListener(window, 'load', initialize); </script> </head> <body> <div id="map-canvas"></div> </body> </html>
https://developers[dot]google[dot]com/ma[dot][dot][dot]gon-arrays?hl=ru
как мне сделать на PHP,чтобы этот скрипт взял координаты из MySql.
и показывал на карте все Polygons.
допустим у меня есть table "maps" и column "kords" и в Kords хранятся координаты Polygon'a.
Cords:
CODE ( text):
скопировать код в буфер обмена
Polygon 1 (54.08517342088679, 46.0107421875)(51.876490970614775, 41.8359375)(50.63901028125872, 48.4716796875) (51.6180165487737, 52.2509765625)(54.95238569063361, 51.48193359375) Polygon 2 (46.81509864599243, 45.966796875)(45.9511496866914, 45.19775390625)(45.9511496866914, 46.2744140625) . . . и т д.
заране всем спасибо
|