HOME BLOG

MAPAS API

Galeria de exemplos: Alterar o estilo do polígono (polygon)

Este exemplo demonstra como poderá alterar o estilo do polígono (polygon).

				<html>
					<head>
						<title>Polygon Custom Style</title>
						<script type="text/javascript" src="http://js.sapo.pt/Bundles/SAPOMapsAPI.js"></script>
						<script type='text/javascript'>
							
							function init() { 
								var map = new SAPO.Maps.Map('mapDiv');
								
								var polygon = new SAPO.Maps.Polygon([new OpenLayers.LonLat(-9, 37),
																new OpenLayers.LonLat(-8, 40),
																new OpenLayers.LonLat(-9, 42),
																new OpenLayers.LonLat(-9, 37),
															   ],
															   {
															   	strokeColor: '#FF00FF',
																strokeOpacity: 1,
																strokeWidth: 6,
																strokeDashstyle: 'dasht',
																fillColor: '#000000',
																fillOpacity: 0.5
															   });
								map.addOverlay(polygon);
							}
							
						</script>
					</head>
					<body onload='init();'>
						<div id='mapDiv' style='width:980px; height:400px;'></div>
					</body>
				</html>