Herramientas de usuario

Herramientas del sitio


informatica:lenguajes_de_programacion:javascript:bibliotecas:openstreetmaps

Tabla de Contenidos

MAPAS web

Extensiones OSM

https://mappinggis.com/2017/01/plugins-para-openlayers-3/

http://viglino.github.io/ol-ext/

ejemplo:

<html>
	<head>
		<title>Test Maps</title>
<script src="http://www.openlayers.org/api/OpenLayers.js"></script>
<script>
 
function carga() {
    map = new OpenLayers.Map("mapdiv");
    map.addLayer(new OpenLayers.Layer.OSM());
 
    //var lonLat = new OpenLayers.LonLat( -0.1279688 ,51.5077286 )
	var lonLat = new OpenLayers.LonLat( -77.1029758, -12.0544268	)
          .transform(
            new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
            map.getProjectionObject() // to Spherical Mercator Projection
          );
 
    var zoom=16;
 
    var markers = new OpenLayers.Layer.Markers( "Markers" );
    map.addLayer(markers);
 
    markers.addMarker(new OpenLayers.Marker(lonLat));
 
    map.setCenter (lonLat, zoom);
 
 
}
 
</script>
	</head>
	<body onload="carga()">
 
		<div id="mapdiv" style="width:700px;height:500px;"></div>
 
	</body>
</html>

sdf asdfs dfasfd

Ejemplo 2

 locations = [[-77.3861, 38.9695], [-122.1781, 37.459], [-122.1781, 37.459], [-122.1781, 37.459], [-122.1781, 37.459], [-122.1826, 37.3762], [-122.1781, 37.459], [-122.1826, 37.3762], [-122.1826, 37.3762], [-122.1826, 37.3762]];
  var lines = new OpenLayers.Layer.Vector("Lines Overlay");
  var coordinates = [];
  for (var i = 0; i < locations.length; i++) {
    coordinates.push(new OpenLayers.Geometry.Point(locations[i][0], locations[i][1]).transform(fromProjection, toProjection));
  }
  var feature = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(coordinates));
  lines.addFeatures(feature);
  map.addLayer(lines);
informatica/lenguajes_de_programacion/javascript/bibliotecas/openstreetmaps.txt · Última modificación: 2025/06/27 03:18 por admin