Geographic Information Systems Asked by zadrozny on December 20, 2020
How can I overlay the country shapes from this Leaflet example onto a WebGL Earth globe?
I’ve tried replacing geojson = L.geoJson(euCountries).addTo(map);
with geojson = WE.geoJson(euCountries).addTo(earth);
.
This produces: TypeError: WE.geoJson is not a function
I am adapting this code, importing the data and making the change listed above, to produce this:
<!DOCTYPE HTML>
<html>
<head>
<script src="http://www.webglearth.com/v2/api.js"></script>
<script type="text/javascript" src="https://leafletjs.com/examples/map-panes/eu-countries.js"></script>
<script>
function initialize() {
var earth = new WE.map('earth_div');
WE.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(earth);
var marker = WE.marker([51.5, -0.09]).addTo(earth);
marker.bindPopup("<b>Hello world!</b><br>I am a popup.<br /><span style='font-size:10px;color:#999'>Tip: Another popup is hidden in Cairo..</span>", {maxWidth: 150, closeButton: true}).openPopup();
var marker2 = WE.marker([30.058056, 31.228889]).addTo(earth);
marker2.bindPopup("<b>Cairo</b><br>Yay, you found me!", {maxWidth: 120, closeButton: false});
var markerCustom = WE.marker([50, -9], '/img/logo-webglearth-white-100.png', 100, 24).addTo(earth);
geojson = WE.geoJson(euCountries).addTo(earth);
earth.setView([51.505, 0], 3);
}
</script>
<style>
html, body{padding: 0; margin: 0; background-color: black;}
#earth_div{top: 0; right: 0; bottom: 0; left: 0; position: absolute !important;}
</style>
<title>WebGL Earth API: Markers</title>
</head>
<body onload="initialize()">
<div id="earth_div"></div>
</body>
</html>
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP