Changeset 8282 in genesis for nodes/nodemap.html
- Timestamp:
- Aug 9, 2010, 9:08:03 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
nodes/nodemap.html
r8280 r8282 9 9 } 10 10 </style> 11 <script src="http://www.openlayers.org/api/OpenLayers.js"></script> 11 <!-- <script src="http://www.openlayers.org/api/OpenLayers.js"></script> --> 12 <script src="http://openlayers.org/dev/OpenLayers.js"</script> 13 12 14 <script> 13 15 function init() { … … 16 18 map.addLayer(mapnik); 17 19 18 var pois = new OpenLayers.Layer.Text( "My Points", 19 { location:"./textfile.txt", 20 projection: map.displayProjection 21 }); 22 map.addLayer(pois); 20 //layer = new OpenLayers.Layer.WMS( "OpenLayers WMS", 21 // "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} ); 22 //map.addLayer(layer); 23 //var pois = new OpenLayers.Layer.Text( "My Points", 24 // { location:"./textfile.txt", 25 // projection: map.displayProjection 26 // }); 27 //map.addLayer(pois); 23 28 24 var vectors = new OpenLayers.Layer.Vector("Vector Layer") 25 map.addLayer(vectors); 26 map.addControl(new OpenLayers.Control.MousePosition()); 27 map.addControl(new OpenLayers.Control.EditingToolbar(vectors)); 29 var kml = new OpenLayers.Layer.GML("KML", "./kmlfile.kml", 30 { format: OpenLayers.Format.KML, 31 formatOptions: { 32 extractStyles: true, 33 extractAttributes: true, 34 maxDepth: 2 35 } 36 }); 37 map.addLayer(kml); 28 38 29 var in_options = {30 'internalProjection': map.baseLayer.projection,31 'externalProjection': new OpenLayers.Projection("EPSG:4326")32 };33 var wkt = new OpenLayers.Format.WKT(in_options);34 var txtFile = new XMLHttpRequest();35 txtFile.open("GET", "./wktfile.txt", false);36 // txtFile.onreadystatechange = function() {37 // if(txtFile.readyState == 4) {38 // alert(txtFile.responseText);39 // }40 // }41 txtFile.send(null);42 39 43 var features = wkt.read(txtFile.responseText.replace(/\n/g,'')); 44 var bounds; 45 46 if (features) { 47 if(features.constructor != Array) { 48 features = [features]; 49 } 50 for(var i=0; i<features.length; ++i) { 51 if (!bounds) { 52 bounds = features[i].geometry.getBounds(); 53 } 54 bounds.extend(features[i].geometry.getBounds()); 55 } 56 vectors.addFeatures(features); 57 map.zoomToExtent(bounds); 58 } else { 59 alert("ERROR in WTK"); 60 } 40 //var vectors = new OpenLayers.Layer.Vector("Vector Layer") 41 //map.addLayer(vectors); 42 //map.addControl(new OpenLayers.Control.MousePosition()); 43 //map.addControl(new OpenLayers.Control.EditingToolbar(vectors)); 44 45 //var in_options = { 46 // 'internalProjection': map.baseLayer.projection, 47 // 'externalProjection': new OpenLayers.Projection("EPSG:4326") 48 //}; 49 //var wkt = new OpenLayers.Format.WKT(in_options); 50 //var txtFile = new XMLHttpRequest(); 51 //txtFile.open("GET", "./wktfile.txt", false); 52 //// txtFile.onreadystatechange = function() { 53 //// if(txtFile.readyState == 4) { 54 //// alert(txtFile.responseText); 55 //// } 56 //// } 57 //txtFile.send(null); 58 59 //var features = wkt.read(txtFile.responseText.replace(/\n/g,'')); 60 //var bounds; 61 // 62 //if (features) { 63 // if(features.constructor != Array) { 64 // features = [features]; 65 // } 66 // for(var i=0; i<features.length; ++i) { 67 // if (!bounds) { 68 // bounds = features[i].geometry.getBounds(); 69 // } 70 // bounds.extend(features[i].geometry.getBounds()); 71 // } 72 // vectors.addFeatures(features); 73 // map.zoomToExtent(bounds); 74 //} else { 75 // alert("ERROR in WTK"); 76 //} 61 77 62 78 map.setCenter(new OpenLayers.LonLat(4.40,52.186) // Center of the map
Note:
See TracChangeset
for help on using the changeset viewer.