-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EPSG: 4326 and Groundoverlays support #9
Comments
Hi Prasanjit, this library depends on tmcw/togeojson for the parsing of kml files, here you can see the currently supported features (i.e. GroundOverlays are not in that list). As for images, try removing leading / trailing spaces. For example: <href> images/modelimage.kml.png </href> should become: <href>images/modelimage.kml.png</href> (however I don't think it will have any effect because this tag is within a As a general rule, always try to avoid all those empty spaces within kml tags. Regards, |
Thank You, Raruto, for the deeper insight. Much appreciated. I will try as you suggested but got two more associated questions (for just the KML display part):
Thanks and regards and let's stay safe wherever we all are. |
Yes, in general leaflet map does not automatically perform conversions for you. Therefore solutions to this can then be many and varied (eg. server / client side reprojection). As for those two CRS mentioned above, leaflet should be able to natively support them both (but not "simultaneously"), otherwise try to take a look at this library: Proj4Leaflet. If in doubt, try searching on: gis.stackexchange.com and stackoverflow.com
In javascript, unpacking zipped files is an asynchronous operation, and therefore, the easiest way to access it is within the callback function: // Your callback function
function addLayer(layer, name) {
layer.addTo(map); // <-- same as kmzParser.get(0).layer.addTo(map)
}
// Instantiate KMZ parser (async)
var kmzParser = new L.KMZParser({ onKMZLoaded: addLayer });
kmzParser.load(kmzUrl); Otherwise you can also try doing such a thing: <label>
<input type="checkbox" onchange="toggleLayer(this)" checked>
toggleLayer
</label>
<script>
function toggleLayer(e) {
var kmz = kmzParser.get(0);
if(kmz) { // <-- check needed because `kmzParser.load(kmzUrl);` is async
kmz.layer[e.checked ? 'removeFrom' : 'addTo' ](map);
}
}
</script> |
Closing the thread for now. |
Probably the problem is due to the mapbox/geojson-vt#57 library (used within this library to optimize map rendering for large volumes of vector data).
By chance, does it works in this way? // Instantiate KMZ parser (async)
var kmzParser = new L.KMZParser({
onKMZLoaded: function(layer, name) {
layer.addTo(map);
}
});
kmzParser.load(kmzUrl, { tiled: false } ); // <-- add tiled option here |
Does it parse and display all elements of the KMZ file?
I tried with one sample file (attached below), and it displays only the associated KML file but ignores the PNG images, logo, color bar, etc. The plugin is useful but it would be nice to have a full parse capability as KMZ files are meant to pack various information.
Example file:
(please modify the extension: rename to
.kmz
).S1A_ESA_2020_04_06_07_14_06_0639472446_168.65E_15.46S_VH_C-7_GFS05CDF_wind.ZIP
Below is the HTML, CSS, JS in index.html file. Your help is much appreciated.
The text was updated successfully, but these errors were encountered: