Jump to content
  • 0

Googlemapapi Динамические Маркеры


HugoBorz
 Share

Question

Доброго всем времени суток.

Есть код:

<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript"
src="http://www.google.com/jsapi?key=ABQIAAAAy23H4tb9RWE5p2dJa8tz9Q"></script>
<script type="text/javascript">
google.load("maps", "2", {"language" : "ru"});
google.load("search", "1");
function initialize() {
var map = new google.maps.Map2(document.getElementById("map"));
map.setCenter(new google.maps.LatLng(28.717888, 27.461350), 15);

var point = new GLatLng(28.717888, 27.461350);
var marker = new GMarker(point);
map.addOverlay(marker);

map.addControl(new GOverviewMapControl());
var map_ctrl=new GLargeMapControl();
var map_type_ctrl=new GMapTypeControl();
var map_scale_ctrl=new GScaleControl();
map.addControl(map_ctrl);
map.addControl(map_type_ctrl);
}
google.setOnLoadCallback(initialize);

</script>
<style type="text/css">
.block1
{
border: solid 0px black;
float: left;
}
.block2
{
width: 250px;
background: #E6E6FA;
padding: 10px;
border: solid 1px black;
float: left;
position: relative;
top: 0px;
left: 5px;
}
.block3
{
width: 250px;
background: #FFE4C4;
padding: 10px;
border: solid 1px black;
float: left;
position: relative;
top: 5px;
left: 5px;
}
</style>
</head>
<body>
<script type="text/javascript">
</script>
<div class="block1" id="map" style="width: 75%; height: 90%"></div>
</font>
</div>
</body>
</html>

Задача, сделать чтобы при изминении координат на сервере, допустим в файле data.xml маркер получал их и динамически перемещался по карте, без перезагрузки всей страницы.

Есть сам код из извлечения данных из файла:

	 GDownloadUrl("data.xml", function(data, responseCode) {
var xml = GXml.parse(data);
//Распарсиваем маркеры
var markers = xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lng")));
var marker = new GMarker(point);
map.addOverlay(marker); //отображаем маркер
}
});

В общем третий день мучаюсь, подскажите плиз как реализовать данную задучу?

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy