Commit 016fd1cb authored by duminil's avatar duminil
Browse files

Displaying citygmls convex hulls with openlayers+kml.

parent 71899064
This diff is collapsed.
<!doctype html> <!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<link rel="stylesheet" href="http://openlayers.org/en/v3.4.0/css/ol.css" type="text/css"> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1" />
<style> <script type="text/javascript" src="gmaps/proj4.js"></script>
.map { <link rel="stylesheet" href="http://openlayers.org/en/v3.4.0/css/ol.css"
height: 400px; type="text/css">
width: 100%; <style>
} .map {
</style> height: 100vh;
<script src="http://openlayers.org/en/v3.4.0/build/ol.js" type="text/javascript"></script> width: 100%;
<title>OpenLayers 3 example</title> }
</head> </style>
<body> <script src="http://openlayers.org/en/v3.4.0/build/ol.js"
<h2>My Map</h2> type="text/javascript"></script>
<div id="map" class="map"></div> <title>RegionChooser OpenLayers</title>
<script type="text/javascript"> </head>
var map = new ol.Map({ <body>
target: 'map', <h2>RegionChooser</h2>
layers: [ <div id="map" class="map"></div>
new ol.layer.Tile({ <script src="simstadt_openlayers.js" type="text/javascript"></script>
source: new ol.source.MapQuest({layer: 'sat'}) </body>
})
],
view: new ol.View({
center: ol.proj.transform([37.41, 8.82], 'EPSG:4326', 'EPSG:3857'),
zoom: 4
})
});
</script>
</body>
</html> </html>
\ No newline at end of file
//proj4.defs("EPSG:31467",
// "+proj=tmerc +lat_0=0 +lon_0=9 +k=1 +x_0=3500000 +y_0=0"
// + " +ellps=bessel +datum=potsdam +units=m +no_defs"); // http://spatialreference.org/ref/epsg/31467/proj4js/
var osm_layer = new ol.layer.Tile({
// source: new ol.source.MapQuest({layer: 'sat'})
source : new ol.source.OSM()
});
var kml_source = new ol.source.KML({
projection : ol.proj.get('EPSG:3857'),
url : 'data/citygml_hulls.kml'
})
var kml_layer = new ol.layer.Vector({
source : kml_source
});
kml_layer.addEventListener("change", function(event) {
map.getView().fitExtent(kml_source.getExtent(), (map.getSize()));
});
var map = new ol.Map({
target : 'map',
layers : [ osm_layer, kml_layer ],
});
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment