Last active
January 6, 2018 18:38
-
-
Save cergey-obr/eeec7d23095b9c8c7614b37959527726 to your computer and use it in GitHub Desktop.
polyline from base64
This file contains 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
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<title>Примеры. Создание ломаной из закодированных вершин.</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<script src="https://api-maps.yandex.ru/1.1/index.xml" type="text/javascript"></script> | |
<script type="text/javascript"> | |
YMaps.jQuery(function () { | |
var map = new YMaps.Map(YMaps.jQuery("#YMapsID")[0]); | |
map.setCenter(new YMaps.GeoPoint(37.591298, 55.734172), 16); | |
var style = new YMaps.Style(); | |
style.lineStyle = new YMaps.LineStyle(); | |
style.lineStyle.strokeColor = "00add0"; | |
style.lineStyle.strokeWidth = 6; | |
var polyline = YMaps.Polyline.fromEncodedPoints("gMPJAYDw-gJAQg8AQEIPAEBCDwBAQg8A", "AAA"); | |
polyline.setStyle(style); | |
map.addOverlay(polyline); | |
}) | |
</script> | |
</head> | |
<body> | |
<div id="YMapsID" style="width:600px;height:400px"></div> | |
</body> | |
</html> |
This file contains 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
(function($){ | |
jQuery.fn.yandexMap = function(){ | |
ymaps.ready(function() { | |
var map = new ymaps.Map('map-container', { | |
center: [55.753198, 37.621727], | |
controls: ['zoomControl'], | |
zoom: 9 | |
}); | |
map.behaviors.disable('scrollZoom'); | |
var base64Coords = "gMPJAYDw-gJAQg8AQEIPAEBCDwBAQg8A"; | |
var geometry = ymaps.geometry.LineString.fromEncodedCoordinates(base64Coords); | |
var polyline = new ymaps.Polyline(geometry, {}, { | |
strokeColor: '#00add0', | |
strokeWidth: 6 | |
}); | |
map.geoObjects.add(polyline); | |
}); | |
}; | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment