Remove old ol.parser.KML
This commit is contained in:
@@ -1,75 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
|
||||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
|
|
||||||
<link rel="stylesheet" href="../css/ol.css" type="text/css">
|
|
||||||
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
|
|
||||||
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
|
|
||||||
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
|
|
||||||
<title>Earthquakes in KML</title>
|
|
||||||
<style>
|
|
||||||
#map {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
#info {
|
|
||||||
position: absolute;
|
|
||||||
height: 1px;
|
|
||||||
width: 1px;
|
|
||||||
z-index: 100;
|
|
||||||
}
|
|
||||||
.tooltip.in {
|
|
||||||
opacity: 1;
|
|
||||||
filter: alpha(opacity=100);
|
|
||||||
}
|
|
||||||
.tooltip.top .tooltip-arrow {
|
|
||||||
border-top-color: white;
|
|
||||||
}
|
|
||||||
.tooltip-inner {
|
|
||||||
border: 2px solid white;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
|
||||||
<div class="navbar-inner">
|
|
||||||
<div class="container">
|
|
||||||
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container-fluid">
|
|
||||||
|
|
||||||
<div class="row-fluid">
|
|
||||||
<div class="span12">
|
|
||||||
<div id="map" class="map"><div id="info"></div></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row-fluid">
|
|
||||||
|
|
||||||
<div class="span12">
|
|
||||||
<h4 id="title">Earthquakes in KML</h4>
|
|
||||||
<p id="shortdesc">Demonstrates the use of a Shape symbolizer to render earthquake locations.</p>
|
|
||||||
<div id="docs">
|
|
||||||
<p>
|
|
||||||
This example parses a KML file and renders the features as a vector layer. The layer is given a <code>ol.style.Style</code> that renders earthquake locations with a size relative to their magnitude. The style uses a <code>ol.style.Shape</code> symbolizer where the <code>size</code> comes from the <code>magnitude</code> attribute on the features.
|
|
||||||
</p>
|
|
||||||
<p>See the <a href="kml-earthquakes.js" target="_blank">kml-earthquakes.js source</a> to see how this is done.</p>
|
|
||||||
</div>
|
|
||||||
<div id="tags">KML, vector, style</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script src="jquery.min.js" type="text/javascript"></script>
|
|
||||||
<script src="../resources/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
|
|
||||||
<script src="loader.js?id=kml-earthquakes" type="text/javascript"></script>
|
|
||||||
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,93 +0,0 @@
|
|||||||
goog.require('ol.Map');
|
|
||||||
goog.require('ol.RendererHint');
|
|
||||||
goog.require('ol.View2D');
|
|
||||||
goog.require('ol.expr');
|
|
||||||
goog.require('ol.layer.Tile');
|
|
||||||
goog.require('ol.layer.Vector');
|
|
||||||
goog.require('ol.parser.KML');
|
|
||||||
goog.require('ol.source.Stamen');
|
|
||||||
goog.require('ol.source.Vector');
|
|
||||||
goog.require('ol.style.Fill');
|
|
||||||
goog.require('ol.style.Shape');
|
|
||||||
goog.require('ol.style.Stroke');
|
|
||||||
goog.require('ol.style.Style');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var style = new ol.style.Style({
|
|
||||||
symbolizers: [
|
|
||||||
new ol.style.Shape({
|
|
||||||
size: ol.expr.parse('5 + 20 * (magnitude - 5)'),
|
|
||||||
fill: new ol.style.Fill({
|
|
||||||
color: '#ff9900',
|
|
||||||
opacity: 0.4
|
|
||||||
}),
|
|
||||||
stroke: new ol.style.Stroke({
|
|
||||||
color: '#ffcc00',
|
|
||||||
opacity: 0.2
|
|
||||||
})
|
|
||||||
})
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
var vector = new ol.layer.Vector({
|
|
||||||
source: new ol.source.Vector({
|
|
||||||
parser: new ol.parser.KML(),
|
|
||||||
url: 'data/kml/2012_Earthquakes_Mag5.kml'
|
|
||||||
}),
|
|
||||||
style: style
|
|
||||||
});
|
|
||||||
|
|
||||||
var raster = new ol.layer.Tile({
|
|
||||||
source: new ol.source.Stamen({
|
|
||||||
layer: 'toner'
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
var map = new ol.Map({
|
|
||||||
layers: [raster, vector],
|
|
||||||
renderer: ol.RendererHint.CANVAS,
|
|
||||||
target: 'map',
|
|
||||||
view: new ol.View2D({
|
|
||||||
center: [0, 0],
|
|
||||||
zoom: 2
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
var info = $('#info');
|
|
||||||
info.tooltip({
|
|
||||||
animation: false,
|
|
||||||
trigger: 'manual'
|
|
||||||
});
|
|
||||||
|
|
||||||
var displayFeatureInfo = function(pixel) {
|
|
||||||
info.css({
|
|
||||||
left: pixel[0] + 'px',
|
|
||||||
top: (pixel[1] - 15) + 'px'
|
|
||||||
});
|
|
||||||
map.getFeatures({
|
|
||||||
pixel: pixel,
|
|
||||||
layers: [vector],
|
|
||||||
success: function(layerFeatures) {
|
|
||||||
var feature = layerFeatures[0][0];
|
|
||||||
if (feature) {
|
|
||||||
info.tooltip('hide')
|
|
||||||
.attr('data-original-title', feature.get('name'))
|
|
||||||
.tooltip('fixTitle')
|
|
||||||
.tooltip('show');
|
|
||||||
} else {
|
|
||||||
info.tooltip('hide');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$(map.getViewport()).on('mousemove', function(evt) {
|
|
||||||
var pixel = map.getEventPixel(evt.originalEvent);
|
|
||||||
displayFeatureInfo(pixel);
|
|
||||||
});
|
|
||||||
|
|
||||||
map.on('singleclick', function(evt) {
|
|
||||||
var pixel = evt.getPixel();
|
|
||||||
displayFeatureInfo(pixel);
|
|
||||||
});
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
|
||||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
|
|
||||||
<link rel="stylesheet" href="../css/ol.css" type="text/css">
|
|
||||||
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
|
|
||||||
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
|
|
||||||
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
|
|
||||||
<title>Timezones in KML</title>
|
|
||||||
<style>
|
|
||||||
#map {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
#info {
|
|
||||||
position: absolute;
|
|
||||||
height: 1px;
|
|
||||||
width: 1px;
|
|
||||||
z-index: 100;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
|
||||||
<div class="navbar-inner">
|
|
||||||
<div class="container">
|
|
||||||
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container-fluid">
|
|
||||||
|
|
||||||
<div class="row-fluid">
|
|
||||||
<div class="span12">
|
|
||||||
<div id="map" class="map"><div id="info"></div></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row-fluid">
|
|
||||||
|
|
||||||
<div class="span12">
|
|
||||||
<h4 id="title">Timezones in KML</h4>
|
|
||||||
<p id="shortdesc">Demonstrates rendering timezones from KML.</p>
|
|
||||||
<div id="docs">
|
|
||||||
<p>This example parses a KML file and renders the features as a vector layer. The layer is given a <code>ol.style.Style</code> that fills timezones yellow with an opacity calculated based on the current offset to local noon.</p>
|
|
||||||
<p>See the <a href="kml-timezones.js" target="_blank">kml-timezones.js source</a> to see how this is done.</p>
|
|
||||||
</div>
|
|
||||||
<div id="tags">KML, vector, style</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script src="jquery.min.js" type="text/javascript"></script>
|
|
||||||
<script src="../resources/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
|
|
||||||
<script src="loader.js?id=kml-timezones" type="text/javascript"></script>
|
|
||||||
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,115 +0,0 @@
|
|||||||
goog.require('ol.Map');
|
|
||||||
goog.require('ol.RendererHint');
|
|
||||||
goog.require('ol.View2D');
|
|
||||||
goog.require('ol.expr');
|
|
||||||
goog.require('ol.layer.Tile');
|
|
||||||
goog.require('ol.layer.Vector');
|
|
||||||
goog.require('ol.parser.KML');
|
|
||||||
goog.require('ol.source.Stamen');
|
|
||||||
goog.require('ol.source.Vector');
|
|
||||||
goog.require('ol.style.Fill');
|
|
||||||
goog.require('ol.style.Stroke');
|
|
||||||
goog.require('ol.style.Style');
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register a function to be used in a symbolizer. Here we want the opacity
|
|
||||||
* of polygons to be based on the offset from local noon. For example, a
|
|
||||||
* timezone where it is currently noon would have an opacity of 0.75. And a
|
|
||||||
* timezone where it is currently midnight would have an opacity of 0. This
|
|
||||||
* doesn't account for daylight savings, so don't use it to plan your vacation.
|
|
||||||
*/
|
|
||||||
ol.expr.register('getOpacity', function() {
|
|
||||||
var feature = this;
|
|
||||||
var offset = 0;
|
|
||||||
var name = feature.get('name'); // e.g. GMT -08:30
|
|
||||||
var match = name.match(/([-+]\d{2}):(\d{2})$/);
|
|
||||||
if (match) {
|
|
||||||
var hours = parseInt(match[1], 10);
|
|
||||||
var minutes = parseInt(match[2], 10);
|
|
||||||
offset = 60 * hours + minutes;
|
|
||||||
}
|
|
||||||
var date = new Date();
|
|
||||||
var local = new Date(date.getTime() +
|
|
||||||
(date.getTimezoneOffset() + offset) * 60000);
|
|
||||||
// offset from local noon (in hours)
|
|
||||||
var delta = Math.abs(12 - local.getHours() + (local.getMinutes() / 60));
|
|
||||||
if (delta > 12) {
|
|
||||||
delta = 24 - delta;
|
|
||||||
}
|
|
||||||
return 0.75 * (1 - delta / 12);
|
|
||||||
});
|
|
||||||
|
|
||||||
var style = new ol.style.Style({
|
|
||||||
symbolizers: [
|
|
||||||
new ol.style.Fill({
|
|
||||||
color: '#ffff33',
|
|
||||||
opacity: ol.expr.parse('getOpacity()')
|
|
||||||
}),
|
|
||||||
new ol.style.Stroke({
|
|
||||||
color: '#ffffff'
|
|
||||||
})
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
var vector = new ol.layer.Vector({
|
|
||||||
source: new ol.source.Vector({
|
|
||||||
parser: new ol.parser.KML(),
|
|
||||||
url: 'data/kml/timezones.kml'
|
|
||||||
}),
|
|
||||||
style: style
|
|
||||||
});
|
|
||||||
|
|
||||||
var raster = new ol.layer.Tile({
|
|
||||||
source: new ol.source.Stamen({
|
|
||||||
layer: 'toner'
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
var map = new ol.Map({
|
|
||||||
layers: [raster, vector],
|
|
||||||
renderer: ol.RendererHint.CANVAS,
|
|
||||||
target: 'map',
|
|
||||||
view: new ol.View2D({
|
|
||||||
center: [0, 0],
|
|
||||||
zoom: 2
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
var info = $('#info');
|
|
||||||
info.tooltip({
|
|
||||||
animation: false,
|
|
||||||
trigger: 'manual'
|
|
||||||
});
|
|
||||||
|
|
||||||
var displayFeatureInfo = function(pixel) {
|
|
||||||
info.css({
|
|
||||||
left: pixel[0] + 'px',
|
|
||||||
top: (pixel[1] - 15) + 'px'
|
|
||||||
});
|
|
||||||
map.getFeatures({
|
|
||||||
pixel: pixel,
|
|
||||||
layers: [vector],
|
|
||||||
success: function(layerFeatures) {
|
|
||||||
var feature = layerFeatures[0][0];
|
|
||||||
if (feature) {
|
|
||||||
info.tooltip('hide')
|
|
||||||
.attr('data-original-title', feature.get('name'))
|
|
||||||
.tooltip('fixTitle')
|
|
||||||
.tooltip('show');
|
|
||||||
} else {
|
|
||||||
info.tooltip('hide');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$(map.getViewport()).on('mousemove', function(evt) {
|
|
||||||
var pixel = map.getEventPixel(evt.originalEvent);
|
|
||||||
displayFeatureInfo(pixel);
|
|
||||||
});
|
|
||||||
|
|
||||||
map.on('singleclick', function(evt) {
|
|
||||||
var pixel = evt.getPixel();
|
|
||||||
displayFeatureInfo(pixel);
|
|
||||||
});
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
|
||||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
|
|
||||||
<link rel="stylesheet" href="../css/ol.css" type="text/css">
|
|
||||||
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
|
|
||||||
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
|
|
||||||
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
|
|
||||||
<title>KML example</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
|
||||||
<div class="navbar-inner">
|
|
||||||
<div class="container">
|
|
||||||
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container-fluid">
|
|
||||||
|
|
||||||
<div class="row-fluid">
|
|
||||||
<div class="span12">
|
|
||||||
<div id="map" class="map"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row-fluid">
|
|
||||||
|
|
||||||
<div class="span4">
|
|
||||||
<h4 id="title">KML example</h4>
|
|
||||||
<p id="shortdesc">Example of using the KML parser.</p>
|
|
||||||
<div id="docs">
|
|
||||||
<p>See the <a href="kml.js" target="_blank">kml.js source</a> to see how this is done.</p>
|
|
||||||
</div>
|
|
||||||
<div id="tags">KML</div>
|
|
||||||
</div>
|
|
||||||
<div class="span4 offset4">
|
|
||||||
<div id="info" class="alert alert-success">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script src="jquery.min.js" type="text/javascript"></script>
|
|
||||||
<script src="loader.js?id=kml" type="text/javascript"></script>
|
|
||||||
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
goog.require('ol.Map');
|
|
||||||
goog.require('ol.RendererHint');
|
|
||||||
goog.require('ol.View2D');
|
|
||||||
goog.require('ol.layer.Tile');
|
|
||||||
goog.require('ol.layer.Vector');
|
|
||||||
goog.require('ol.parser.KML');
|
|
||||||
goog.require('ol.source.TileWMS');
|
|
||||||
goog.require('ol.source.Vector');
|
|
||||||
|
|
||||||
var raster = new ol.layer.Tile({
|
|
||||||
source: new ol.source.TileWMS({
|
|
||||||
url: 'http://vmap0.tiles.osgeo.org/wms/vmap0',
|
|
||||||
crossOrigin: null,
|
|
||||||
params: {
|
|
||||||
'LAYERS': 'basic',
|
|
||||||
'VERSION': '1.1.1',
|
|
||||||
'FORMAT': 'image/jpeg'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
var vector = new ol.layer.Vector({
|
|
||||||
source: new ol.source.Vector({
|
|
||||||
parser: new ol.parser.KML({
|
|
||||||
maxDepth: 1, extractStyles: true, extractAttributes: true
|
|
||||||
}),
|
|
||||||
url: 'data/kml/lines.kml'
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
var map = new ol.Map({
|
|
||||||
layers: [raster, vector],
|
|
||||||
renderer: ol.RendererHint.CANVAS,
|
|
||||||
target: 'map',
|
|
||||||
view: new ol.View2D({
|
|
||||||
projection: 'EPSG:4326',
|
|
||||||
center: [-112.169, 36.099],
|
|
||||||
zoom: 11
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
var displayFeatureInfo = function(pixel) {
|
|
||||||
map.getFeatures({
|
|
||||||
pixel: pixel,
|
|
||||||
layers: [vector],
|
|
||||||
success: function(featuresByLayer) {
|
|
||||||
var features = featuresByLayer[0];
|
|
||||||
var info = [];
|
|
||||||
for (var i = 0, ii = features.length; i < ii; ++i) {
|
|
||||||
info.push(features[i].get('name'));
|
|
||||||
}
|
|
||||||
document.getElementById('info').innerHTML = info.join(', ') || ' ';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$(map.getViewport()).on('mousemove', function(evt) {
|
|
||||||
var pixel = map.getEventPixel(evt.originalEvent);
|
|
||||||
displayFeatureInfo(pixel);
|
|
||||||
});
|
|
||||||
|
|
||||||
map.on('singleclick', function(evt) {
|
|
||||||
var pixel = evt.getPixel();
|
|
||||||
displayFeatureInfo(pixel);
|
|
||||||
});
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
@exportSymbol ol.parser.KML
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,391 +0,0 @@
|
|||||||
goog.provide('ol.test.parser.KML');
|
|
||||||
|
|
||||||
describe('ol.parser.KML', function() {
|
|
||||||
|
|
||||||
var parser = new ol.parser.KML();
|
|
||||||
|
|
||||||
describe('Test KML parser', function() {
|
|
||||||
it('Polygon read / written correctly', function(done) {
|
|
||||||
var url = 'spec/ol/parser/kml/polygon.kml';
|
|
||||||
afterLoadXml(url, function(xml) {
|
|
||||||
var obj = parser.read(xml);
|
|
||||||
var output = parser.write(obj);
|
|
||||||
expect(goog.dom.xml.loadXml(output)).to.xmleql(xml);
|
|
||||||
expect(obj.features.length).to.eql(1);
|
|
||||||
var geom = obj.features[0].getGeometry();
|
|
||||||
expect(obj.features[0].getId()).to.eql('KML.Polygon');
|
|
||||||
expect(geom instanceof ol.geom.Polygon).to.be.ok();
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
it('Linestring read / written correctly', function(done) {
|
|
||||||
var url = 'spec/ol/parser/kml/linestring.kml';
|
|
||||||
afterLoadXml(url, function(xml) {
|
|
||||||
var obj = parser.read(xml);
|
|
||||||
var output = parser.write(obj);
|
|
||||||
expect(goog.dom.xml.loadXml(output)).to.xmleql(xml);
|
|
||||||
expect(obj.features.length).to.eql(2);
|
|
||||||
var geom = obj.features[0].getGeometry();
|
|
||||||
expect(geom instanceof ol.geom.LineString).to.be.ok();
|
|
||||||
geom = obj.features[1].getGeometry();
|
|
||||||
expect(geom instanceof ol.geom.LineString).to.be.ok();
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
it('Point read / written correctly', function(done) {
|
|
||||||
var url = 'spec/ol/parser/kml/point.kml';
|
|
||||||
afterLoadXml(url, function(xml) {
|
|
||||||
var obj = parser.read(xml);
|
|
||||||
var output = parser.write(obj);
|
|
||||||
expect(goog.dom.xml.loadXml(output)).to.xmleql(xml);
|
|
||||||
expect(obj.features.length).to.eql(1);
|
|
||||||
var geom = obj.features[0].getGeometry();
|
|
||||||
expect(geom instanceof ol.geom.Point).to.be.ok();
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
it('NetworkLink read correctly', function(done) {
|
|
||||||
var url = 'spec/ol/parser/kml/networklink.kml';
|
|
||||||
afterLoadXml(url, function(xml) {
|
|
||||||
var p = new ol.parser.KML({maxDepth: 1});
|
|
||||||
// we need to supply a callback to get visited NetworkLinks
|
|
||||||
p.read(xml, function(obj) {
|
|
||||||
expect(obj.features.length).to.eql(3);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
it('NetworkLink read correctly [recursively]', function(done) {
|
|
||||||
var url = 'spec/ol/parser/kml/networklink_depth.kml';
|
|
||||||
afterLoadXml(url, function(xml) {
|
|
||||||
var p = new ol.parser.KML({maxDepth: 2});
|
|
||||||
// we need to supply a callback to get visited NetworkLinks
|
|
||||||
p.read(xml, function(obj) {
|
|
||||||
expect(obj.features.length).to.eql(2);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
it('NetworkLink maxDepth', function(done) {
|
|
||||||
var url = 'spec/ol/parser/kml/networklink_depth.kml';
|
|
||||||
afterLoadXml(url, function(xml) {
|
|
||||||
var p = new ol.parser.KML({maxDepth: 1});
|
|
||||||
// we need to supply a callback to get visited NetworkLinks
|
|
||||||
p.read(xml, function(obj) {
|
|
||||||
// since maxDepth is 1, we will not get to the second feature
|
|
||||||
expect(obj.features.length).to.eql(1);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
it('Extended data read correctly', function(done) {
|
|
||||||
var url = 'spec/ol/parser/kml/extended_data.kml';
|
|
||||||
afterLoadXml(url, function(xml) {
|
|
||||||
var obj = parser.read(xml);
|
|
||||||
expect(obj.features[0].get('name')).to.eql('Extended data placemark');
|
|
||||||
var description = 'Attached to the ground. Intelligently places ' +
|
|
||||||
'itself \n at the height of the underlying terrain.';
|
|
||||||
expect(obj.features[0].get('description')).to.eql(description);
|
|
||||||
expect(obj.features[0].get('foo')).to.eql('bar');
|
|
||||||
expect(obj.features[0].getId()).to.eql('foobarbaz');
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
it('Extended data read correctly [2]', function(done) {
|
|
||||||
var url = 'spec/ol/parser/kml/extended_data2.kml';
|
|
||||||
afterLoadXml(url, function(xml) {
|
|
||||||
var obj = parser.read(xml);
|
|
||||||
var feature = obj.features[0];
|
|
||||||
expect(feature.get('TrailHeadName')).to.eql('Pi in the sky');
|
|
||||||
expect(feature.get('TrailLength')).to.eql('3.14159');
|
|
||||||
expect(feature.get('ElevationGain')).to.eql('10');
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
it('Multi geometry read / written correctly', function(done) {
|
|
||||||
var url = 'spec/ol/parser/kml/multigeometry.kml';
|
|
||||||
afterLoadXml(url, function(xml) {
|
|
||||||
var obj = parser.read(xml);
|
|
||||||
var geom = obj.features[0].getGeometry();
|
|
||||||
var output = parser.write(obj);
|
|
||||||
expect(goog.dom.xml.loadXml(output)).to.xmleql(xml);
|
|
||||||
expect(geom instanceof ol.geom.MultiLineString).to.be.ok();
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
it('Discrete multi geometry read correctly', function(done) {
|
|
||||||
var url = 'spec/ol/parser/kml/multigeometry_discrete.kml';
|
|
||||||
afterLoadXml(url, function(xml) {
|
|
||||||
var obj = parser.read(xml);
|
|
||||||
var geom = obj.features[0].getGeometry();
|
|
||||||
var components = geom.getComponents();
|
|
||||||
expect(geom instanceof ol.geom.GeometryCollection).to.be.ok();
|
|
||||||
expect(components.length).to.eql(2);
|
|
||||||
expect(components[0] instanceof ol.geom.LineString).to.be.ok();
|
|
||||||
expect(components[1] instanceof ol.geom.Point).to.be.ok();
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
it('Test extract tracks', function(done) {
|
|
||||||
var url = 'spec/ol/parser/kml/macnoise.kml';
|
|
||||||
afterLoadXml(url, function(xml) {
|
|
||||||
var p = new ol.parser.KML({extractStyles: true,
|
|
||||||
trackAttributes: ['speed', 'num']});
|
|
||||||
var obj = p.read(xml);
|
|
||||||
expect(obj.features.length).to.be(170);
|
|
||||||
var attr = obj.features[4].getAttributes();
|
|
||||||
// standard track point attributes
|
|
||||||
expect(attr.when).to.be.a(Date);
|
|
||||||
expect(attr.when.getTime()).to.be(1272736815000);
|
|
||||||
expect(attr.altitude).to.be(1006);
|
|
||||||
expect(attr.heading).to.be(230);
|
|
||||||
expect(attr.tilt).to.be(0);
|
|
||||||
expect(attr.roll).to.be(0);
|
|
||||||
expect(attr.name).to.be('B752');
|
|
||||||
expect(attr.adflag).to.be('A');
|
|
||||||
expect(attr.flightid).to.be('DAL2973');
|
|
||||||
expect(attr.speed).to.be('166');
|
|
||||||
expect(attr.num).to.be('50');
|
|
||||||
var geom = obj.features[4].getGeometry();
|
|
||||||
expect(geom.get(0)).to.be(-93.0753620391713);
|
|
||||||
expect(geom.get(1)).to.be(44.9879724110872);
|
|
||||||
expect(geom.get(2)).to.be(1006);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
it('Test CDATA attributes', function() {
|
|
||||||
var cdata = '<kml xmlns="http://earth.google.com/kml/2.0"><Document>' +
|
|
||||||
'<Placemark><name><![CDATA[Pezinok]]> </name><description>' +
|
|
||||||
'<![CDATA[Full of text.]]></description><styleUrl>#rel1.0' +
|
|
||||||
'</styleUrl><Point> <coordinates>17.266666, 48.283333</coordinates>' +
|
|
||||||
'</Point></Placemark></Document></kml>';
|
|
||||||
var obj = parser.read(cdata);
|
|
||||||
expect(obj.features[0].get('description')).to.eql('Full of text.');
|
|
||||||
expect(obj.features[0].get('name')).to.eql('Pezinok');
|
|
||||||
});
|
|
||||||
it('Test CDATA attributes with newlines', function() {
|
|
||||||
var cdata = '<kml xmlns="http://earth.google.com/kml/2.0"><Document>' +
|
|
||||||
'<Placemark><name><![CDATA[Pezinok]]> </name><description>' +
|
|
||||||
'\n' +
|
|
||||||
'<![CDATA[Full of text.]]>' +
|
|
||||||
'\n' +
|
|
||||||
'</description><styleUrl>#rel1.0' +
|
|
||||||
'</styleUrl><Point> <coordinates>17.266666, 48.283333</coordinates>' +
|
|
||||||
'</Point></Placemark></Document></kml>';
|
|
||||||
var obj = parser.read(cdata);
|
|
||||||
expect(obj.features[0].get('description')).to.eql('Full of text.');
|
|
||||||
expect(obj.features[0].get('name')).to.eql('Pezinok');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('handles line style (read / write)', function() {
|
|
||||||
var kml = '<kml xmlns="http://www.opengis.net/kml/2.2" ' +
|
|
||||||
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
|
|
||||||
'xsi:schemaLocation="http://www.opengis.net/kml/2.2 ' +
|
|
||||||
'http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd"> ' +
|
|
||||||
'<Document><Placemark><Style><LineStyle> <color>870000ff</color> ' +
|
|
||||||
'<width>10</width> </LineStyle> </Style> <LineString> ' +
|
|
||||||
'<coordinates> -112,36 -113,37 </coordinates> </LineString>' +
|
|
||||||
'</Placemark></Document></kml>';
|
|
||||||
var p = new ol.parser.KML({extractStyles: true});
|
|
||||||
var obj = p.read(kml);
|
|
||||||
var output = p.write(obj);
|
|
||||||
expect(goog.dom.xml.loadXml(kml)).to.xmleql(
|
|
||||||
goog.dom.xml.loadXml(output));
|
|
||||||
|
|
||||||
var symbolizers = obj.features[0].getSymbolizers();
|
|
||||||
expect(symbolizers).to.have.length(1);
|
|
||||||
|
|
||||||
var stroke = symbolizers[0];
|
|
||||||
expect(stroke).to.be.a(ol.style.Stroke);
|
|
||||||
|
|
||||||
var literal = stroke.createLiteral(ol.geom.GeometryType.LINE_STRING);
|
|
||||||
expect(literal).to.be.a(ol.style.LineLiteral);
|
|
||||||
expect(literal.color).to.eql('#ff0000');
|
|
||||||
expect(literal.opacity).to.eql(0.5294117647058824);
|
|
||||||
expect(literal.width).to.eql(10);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('reads PolyStyle fill', function() {
|
|
||||||
var kml = '<kml xmlns="http://www.opengis.net/kml/2.2">' +
|
|
||||||
'<Document><Placemark> <Style> <PolyStyle> <fill>1</fill> ' +
|
|
||||||
'<color>870000ff</color></PolyStyle> </Style>' +
|
|
||||||
'<Polygon><outerBoundaryIs><LinearRing><coordinates>' +
|
|
||||||
'5.001370157823406,49.26855713824488 8.214706453896161,' +
|
|
||||||
'49.630662409673505 8.397385910100951,48.45172350357396 ' +
|
|
||||||
'5.001370157823406,49.26855713824488</coordinates></LinearRing>' +
|
|
||||||
'</outerBoundaryIs></Polygon></Placemark><Placemark> <Style> ' +
|
|
||||||
'<PolyStyle><fill>0</fill><color>870000ff</color>' +
|
|
||||||
'</PolyStyle> </Style>' +
|
|
||||||
'<Polygon><outerBoundaryIs><LinearRing><coordinates>' +
|
|
||||||
'5.001370157823406,49.26855713824488 8.214706453896161,' +
|
|
||||||
'49.630662409673505 8.397385910100951,48.45172350357396 ' +
|
|
||||||
'5.001370157823406,49.26855713824488</coordinates></LinearRing>' +
|
|
||||||
'</outerBoundaryIs></Polygon></Placemark></Document></kml>';
|
|
||||||
var p = new ol.parser.KML({extractStyles: true});
|
|
||||||
var obj = p.read(kml);
|
|
||||||
|
|
||||||
var symbolizers = obj.features[0].getSymbolizers();
|
|
||||||
expect(symbolizers).to.have.length(2);
|
|
||||||
expect(symbolizers[0]).to.be.a(ol.style.Fill);
|
|
||||||
expect(symbolizers[1]).to.be.a(ol.style.Stroke);
|
|
||||||
|
|
||||||
var literals = ol.style.Style.createLiterals(
|
|
||||||
symbolizers, ol.geom.GeometryType.POLYGON);
|
|
||||||
expect(literals).to.have.length(1);
|
|
||||||
|
|
||||||
var literal = literals[0];
|
|
||||||
expect(literal).to.be.a(ol.style.PolygonLiteral);
|
|
||||||
expect(literal.fillColor).to.be('#ff0000');
|
|
||||||
expect(literal.strokeColor).to.be('#ff0000');
|
|
||||||
|
|
||||||
symbolizers = obj.features[1].getSymbolizers();
|
|
||||||
expect(symbolizers).to.have.length(1);
|
|
||||||
expect(symbolizers[0]).to.be.a(ol.style.Stroke);
|
|
||||||
|
|
||||||
var literals = ol.style.Style.createLiterals(
|
|
||||||
symbolizers, ol.geom.GeometryType.POLYGON);
|
|
||||||
expect(literals).to.have.length(1);
|
|
||||||
|
|
||||||
literal = literals[0];
|
|
||||||
expect(literal).to.be.a(ol.style.PolygonLiteral);
|
|
||||||
expect(literal.fillColor).to.be(undefined);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('writes PolyStyle fill and outline', function() {
|
|
||||||
var kml = '<kml xmlns="http://www.opengis.net/kml/2.2" ' +
|
|
||||||
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
|
|
||||||
'xsi:schemaLocation="http://www.opengis.net/kml/2.2 ' +
|
|
||||||
'http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd"> ' +
|
|
||||||
'<Document><Placemark><Style><PolyStyle>' +
|
|
||||||
'<fill>1</fill><outline>0</outline>' +
|
|
||||||
'<color>870000ff</color></PolyStyle> </Style>' +
|
|
||||||
'<Polygon><outerBoundaryIs><LinearRing><coordinates>' +
|
|
||||||
'5.001370157823406,49.26855713824488 8.214706453896161,' +
|
|
||||||
'49.630662409673505 8.397385910100951,48.45172350357396 ' +
|
|
||||||
'5.001370157823406,49.26855713824488</coordinates></LinearRing>' +
|
|
||||||
'</outerBoundaryIs></Polygon></Placemark></Document></kml>';
|
|
||||||
var p = new ol.parser.KML({extractStyles: true});
|
|
||||||
var output = p.write(p.read(kml));
|
|
||||||
expect(goog.dom.xml.loadXml(kml)).to.xmleql(
|
|
||||||
goog.dom.xml.loadXml(output));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('handles iconStyle (read / write)', function(done) {
|
|
||||||
var url = 'spec/ol/parser/kml/iconstyle.kml';
|
|
||||||
afterLoadXml(url, function(xml) {
|
|
||||||
var p = new ol.parser.KML({extractStyles: true});
|
|
||||||
var obj = p.read(xml);
|
|
||||||
var output = p.write(obj);
|
|
||||||
expect(goog.dom.xml.loadXml(output)).to.xmleql(xml);
|
|
||||||
|
|
||||||
var symbolizers = obj.features[0].getSymbolizers();
|
|
||||||
expect(symbolizers).to.have.length(1);
|
|
||||||
|
|
||||||
var symbolizer = symbolizers[0];
|
|
||||||
expect(symbolizer).to.be.a(ol.style.Icon);
|
|
||||||
|
|
||||||
var literal = symbolizer.createLiteral(ol.geom.GeometryType.POINT);
|
|
||||||
expect(literal).to.be.a(ol.style.IconLiteral);
|
|
||||||
|
|
||||||
var url = 'http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png';
|
|
||||||
expect(literal.url).to.eql(url);
|
|
||||||
expect(literal.width).to.eql(32);
|
|
||||||
expect(literal.height).to.eql(32);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('handles styleMap (read / write)', function(done) {
|
|
||||||
var url = 'spec/ol/parser/kml/stylemap.kml';
|
|
||||||
afterLoadXml(url, function(xml) {
|
|
||||||
var p = new ol.parser.KML({extractStyles: true});
|
|
||||||
var obj = p.read(xml);
|
|
||||||
var output = p.write(obj);
|
|
||||||
expect(goog.dom.xml.loadXml(output)).to.xmleql(xml);
|
|
||||||
|
|
||||||
var symbolizers = obj.features[0].getSymbolizers();
|
|
||||||
expect(symbolizers).to.have.length(1);
|
|
||||||
|
|
||||||
var symbolizer = symbolizers[0];
|
|
||||||
expect(symbolizer).to.be.a(ol.style.Icon);
|
|
||||||
|
|
||||||
var literal = symbolizer.createLiteral(ol.geom.GeometryType.POINT);
|
|
||||||
expect(literal).to.be.a(ol.style.IconLiteral);
|
|
||||||
|
|
||||||
var url = 'http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png';
|
|
||||||
expect(literal.url).to.eql(url);
|
|
||||||
expect(literal.width).to.eql(32);
|
|
||||||
expect(literal.height).to.eql(32);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('parsing states.kml', function() {
|
|
||||||
|
|
||||||
var features;
|
|
||||||
before(function(done) {
|
|
||||||
afterLoadXml('spec/ol/parser/kml/states.kml', function(xml) {
|
|
||||||
var parser = new ol.parser.KML();
|
|
||||||
var obj;
|
|
||||||
try {
|
|
||||||
obj = parser.read(xml);
|
|
||||||
} catch (err) {
|
|
||||||
return done(err);
|
|
||||||
}
|
|
||||||
if (!obj.features) {
|
|
||||||
return done(new Error('Failed to parse features from doc'));
|
|
||||||
}
|
|
||||||
features = obj.features;
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('creates 50 features', function() {
|
|
||||||
expect(features).to.have.length(50);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('creates features with heterogenous geometry collections', function() {
|
|
||||||
// TODO: decide if we should instead create features with multiple geoms
|
|
||||||
var feature = features[0];
|
|
||||||
expect(feature).to.be.a(ol.Feature);
|
|
||||||
var geometry = feature.getGeometry();
|
|
||||||
expect(geometry).to.be.a(ol.geom.GeometryCollection);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('parses Point and MultiPolygon for Alaska', function() {
|
|
||||||
var alaska = goog.array.find(features, function(feature) {
|
|
||||||
return feature.get('name') === 'Alaska';
|
|
||||||
});
|
|
||||||
expect(alaska).to.be.a(ol.Feature);
|
|
||||||
var geometry = alaska.getGeometry();
|
|
||||||
expect(geometry).to.be.a(ol.geom.GeometryCollection);
|
|
||||||
var components = geometry.getComponents();
|
|
||||||
expect(components).to.have.length(2);
|
|
||||||
expect(components[0]).to.be.a(ol.geom.Point);
|
|
||||||
expect(components[1]).to.be.a(ol.geom.MultiPolygon);
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
goog.require('goog.array');
|
|
||||||
goog.require('goog.dom.xml');
|
|
||||||
|
|
||||||
goog.require('ol.Feature');
|
|
||||||
goog.require('ol.geom.GeometryType');
|
|
||||||
goog.require('ol.geom.GeometryCollection');
|
|
||||||
goog.require('ol.geom.LineString');
|
|
||||||
goog.require('ol.geom.MultiLineString');
|
|
||||||
goog.require('ol.geom.MultiPolygon');
|
|
||||||
goog.require('ol.geom.Point');
|
|
||||||
goog.require('ol.geom.Polygon');
|
|
||||||
goog.require('ol.parser.KML');
|
|
||||||
goog.require('ol.style.Fill');
|
|
||||||
goog.require('ol.style.Icon');
|
|
||||||
goog.require('ol.style.IconLiteral');
|
|
||||||
goog.require('ol.style.LineLiteral');
|
|
||||||
goog.require('ol.style.PolygonLiteral');
|
|
||||||
goog.require('ol.style.Stroke');
|
|
||||||
goog.require('ol.style.Style');
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/kml/2.2 http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd">
|
|
||||||
<Document>
|
|
||||||
<NetworkLink><Link><href>spec/ol/parser/kml/polygon.kml</href></Link></NetworkLink>
|
|
||||||
</Document>
|
|
||||||
</kml>
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/kml/2.2 http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd">
|
|
||||||
<Placemark id="foobarbaz">
|
|
||||||
<name>Extended data placemark</name>
|
|
||||||
<description>Attached to the ground. Intelligently places itself
|
|
||||||
at the height of the underlying terrain.</description>
|
|
||||||
<ExtendedData>
|
|
||||||
<Data name="foo">
|
|
||||||
<value>bar</value>
|
|
||||||
</Data>
|
|
||||||
</ExtendedData>
|
|
||||||
<Point>
|
|
||||||
<coordinates>-122.0822035425683,37.42228990140251,0</coordinates>
|
|
||||||
</Point>
|
|
||||||
</Placemark>
|
|
||||||
</kml>
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<kml xmlns="http://earth.google.com/kml/2.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/kml/2.2 http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd">
|
|
||||||
<Document>
|
|
||||||
<Placemark>
|
|
||||||
<name>Easy trail</name>
|
|
||||||
<ExtendedData>
|
|
||||||
<SchemaData schemaUrl="#TrailHeadTypeId">
|
|
||||||
<SimpleData name="TrailHeadName">Pi in the sky</SimpleData>
|
|
||||||
<SimpleData name="TrailLength">3.14159</SimpleData>
|
|
||||||
<SimpleData name="ElevationGain">10</SimpleData>
|
|
||||||
</SchemaData>
|
|
||||||
</ExtendedData>
|
|
||||||
<Point>
|
|
||||||
<coordinates>-122.000,37.002</coordinates>
|
|
||||||
</Point>
|
|
||||||
</Placemark>
|
|
||||||
<Placemark>
|
|
||||||
<name>Difficult trail</name>
|
|
||||||
<ExtendedData>
|
|
||||||
<SchemaData schemaUrl="#TrailHeadTypeId">
|
|
||||||
<SimpleData name="TrailHeadName">Mount Everest</SimpleData>
|
|
||||||
<SimpleData name="TrailLength">347.45</SimpleData>
|
|
||||||
<SimpleData name="ElevationGain">10000</SimpleData>
|
|
||||||
</SchemaData>
|
|
||||||
</ExtendedData>
|
|
||||||
<Point>
|
|
||||||
<coordinates>-122.000,37.002</coordinates>
|
|
||||||
</Point>
|
|
||||||
</Placemark>
|
|
||||||
</Document>
|
|
||||||
</kml>
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/kml/2.2 http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd">
|
|
||||||
<Document>
|
|
||||||
<Style id="pushpin">
|
|
||||||
<IconStyle id="mystyle">
|
|
||||||
<Icon>
|
|
||||||
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
|
|
||||||
</Icon>
|
|
||||||
</IconStyle>
|
|
||||||
</Style>
|
|
||||||
<Placemark>
|
|
||||||
<name>Pin on a mountaintop</name>
|
|
||||||
<styleUrl>#pushpin</styleUrl>
|
|
||||||
<Point>
|
|
||||||
<coordinates>170.1435558771009,-43.60505741890396,0</coordinates>
|
|
||||||
</Point>
|
|
||||||
</Placemark>
|
|
||||||
</Document>
|
|
||||||
</kml>
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/kml/2.2 http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd">
|
|
||||||
<Document>
|
|
||||||
<name>LineString.kml</name>
|
|
||||||
<open>1</open>
|
|
||||||
<Placemark>
|
|
||||||
<name>unextruded</name>
|
|
||||||
<LineString>
|
|
||||||
<coordinates>
|
|
||||||
-122.364383,37.824664,0 -122.364152,37.824322,0
|
|
||||||
</coordinates>
|
|
||||||
</LineString>
|
|
||||||
</Placemark>
|
|
||||||
<Placemark>
|
|
||||||
<name>extruded</name>
|
|
||||||
<LineString>
|
|
||||||
<coordinates>
|
|
||||||
-122.364167,37.824787,50 -122.363917,37.824423,50
|
|
||||||
</coordinates>
|
|
||||||
</LineString>
|
|
||||||
</Placemark>
|
|
||||||
</Document>
|
|
||||||
</kml>
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,26 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/kml/2.2 http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd">
|
|
||||||
<Document>
|
|
||||||
<name>Polygon.kml</name>
|
|
||||||
<open>0</open>
|
|
||||||
<Placemark>
|
|
||||||
<name>SF Marina Harbor Master</name>
|
|
||||||
<MultiGeometry>
|
|
||||||
<LineString>
|
|
||||||
<!-- north wall -->
|
|
||||||
<coordinates>
|
|
||||||
-122.4425587930444,37.80666418607323,0
|
|
||||||
-122.4428379594768,37.80663578323093,0
|
|
||||||
</coordinates>
|
|
||||||
</LineString>
|
|
||||||
<LineString>
|
|
||||||
<!-- south wall -->
|
|
||||||
<coordinates>
|
|
||||||
-122.4425509770566,37.80662588061205,0
|
|
||||||
-122.4428340530617,37.8065999493009,0
|
|
||||||
</coordinates>
|
|
||||||
</LineString>
|
|
||||||
</MultiGeometry>
|
|
||||||
</Placemark>
|
|
||||||
</Document>
|
|
||||||
</kml>
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/kml/2.2 http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd">
|
|
||||||
<Document>
|
|
||||||
<name>Polygon.kml</name>
|
|
||||||
<open>0</open>
|
|
||||||
<Placemark>
|
|
||||||
<name>SF Marina Harbor Master</name>
|
|
||||||
<visibility>0</visibility>
|
|
||||||
<MultiGeometry>
|
|
||||||
<LineString>
|
|
||||||
<!-- north wall -->
|
|
||||||
<coordinates>
|
|
||||||
-122.4425587930444,37.80666418607323,0
|
|
||||||
-122.4428379594768,37.80663578323093,0
|
|
||||||
</coordinates>
|
|
||||||
</LineString>
|
|
||||||
<Point>
|
|
||||||
<coordinates>
|
|
||||||
-122.4428340530617,37.8065999493009,0
|
|
||||||
</coordinates>
|
|
||||||
</Point>
|
|
||||||
</MultiGeometry>
|
|
||||||
</Placemark>
|
|
||||||
</Document>
|
|
||||||
</kml>
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/kml/2.2 http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd">
|
|
||||||
<Document>
|
|
||||||
<Placemark>
|
|
||||||
<name>Simple placemark</name>
|
|
||||||
<description>Attached to the ground. Intelligently places itself
|
|
||||||
at the height of the underlying terrain.</description>
|
|
||||||
<Point>
|
|
||||||
<coordinates>-122.0822035425683,37.42228990140251,0</coordinates>
|
|
||||||
</Point>
|
|
||||||
</Placemark>
|
|
||||||
<NetworkLink><Link><href>spec/ol/parser/kml/polygon.kml</href></Link></NetworkLink>
|
|
||||||
<NetworkLink><Link><href>spec/ol/parser/kml/point.kml</href></Link></NetworkLink>
|
|
||||||
</Document>
|
|
||||||
</kml>
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/kml/2.2 http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd">
|
|
||||||
<Document>
|
|
||||||
<Placemark>
|
|
||||||
<name>Simple placemark</name>
|
|
||||||
<description>Attached to the ground. Intelligently places itself
|
|
||||||
at the height of the underlying terrain.</description>
|
|
||||||
<Point>
|
|
||||||
<coordinates>-122.0822035425683,37.42228990140251,0</coordinates>
|
|
||||||
</Point>
|
|
||||||
</Placemark>
|
|
||||||
<NetworkLink><Link><href>spec/ol/parser/kml/depth.kml</href></Link></NetworkLink>
|
|
||||||
</Document>
|
|
||||||
</kml>
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/kml/2.2 http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd">
|
|
||||||
<Document>
|
|
||||||
<Placemark>
|
|
||||||
<name>Simple placemark</name>
|
|
||||||
<description>Attached to the ground. Intelligently places itself
|
|
||||||
at the height of the underlying terrain.</description>
|
|
||||||
<Point>
|
|
||||||
<coordinates>-122.0822035425683,37.42228990140251,0</coordinates>
|
|
||||||
</Point>
|
|
||||||
</Placemark>
|
|
||||||
</Document>
|
|
||||||
</kml>
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/kml/2.2 http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd">
|
|
||||||
<Document>
|
|
||||||
<name>Polygon.kml</name>
|
|
||||||
<open>0</open>
|
|
||||||
<Placemark id="KML.Polygon">
|
|
||||||
<name>hollow box</name>
|
|
||||||
<Polygon>
|
|
||||||
<outerBoundaryIs>
|
|
||||||
<LinearRing>
|
|
||||||
<coordinates>-30,-20,0 -30,20,0 30,20,0 30,-20,0 -30,-20,0</coordinates>
|
|
||||||
</LinearRing>
|
|
||||||
</outerBoundaryIs>
|
|
||||||
<innerBoundaryIs>
|
|
||||||
<LinearRing>
|
|
||||||
<coordinates>-15,-10,0 15,-10,0 15,10,0 -15,10,0 -15,-10,0</coordinates>
|
|
||||||
</LinearRing>
|
|
||||||
</innerBoundaryIs>
|
|
||||||
</Polygon>
|
|
||||||
</Placemark>
|
|
||||||
</Document>
|
|
||||||
</kml>
|
|
||||||
File diff suppressed because one or more lines are too long
@@ -1,29 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/kml/2.2 http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd">
|
|
||||||
<Document>
|
|
||||||
<Style id="pushpin">
|
|
||||||
<IconStyle id="mystyle">
|
|
||||||
<Icon>
|
|
||||||
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
|
|
||||||
</Icon>
|
|
||||||
</IconStyle>
|
|
||||||
</Style>
|
|
||||||
<StyleMap id="pushpinStyleMap">
|
|
||||||
<Pair>
|
|
||||||
<key>normal</key>
|
|
||||||
<styleUrl>#pushpin</styleUrl>
|
|
||||||
</Pair>
|
|
||||||
<Pair>
|
|
||||||
<key>highlight</key>
|
|
||||||
<styleUrl>#pushpin</styleUrl>
|
|
||||||
</Pair>
|
|
||||||
</StyleMap>
|
|
||||||
<Placemark>
|
|
||||||
<name>Pin on a mountaintop</name>
|
|
||||||
<styleUrl>#pushpinStyleMap</styleUrl>
|
|
||||||
<Point>
|
|
||||||
<coordinates>170.1435558771009,-43.60505741890396,0</coordinates>
|
|
||||||
</Point>
|
|
||||||
</Placemark>
|
|
||||||
</Document>
|
|
||||||
</kml>
|
|
||||||
Reference in New Issue
Block a user