Loading photos in KML/KMZ files - kml

I am going to develop a mechanism to export as many as approx. 100 photos with their position information to a KML/KMZ file.
Just wondering what is the best practise to do this. My initial quick options are:
1. use html img tag in the description of a placemark to internally reference the actual photos wrapped in the internal "files" folder in the KMZ;
2. use html img tag in the description of a placemark to reference the URL of a photo (publicly accessible).
Option one involves writing all photos in the internal "files" folder of a KMZ. This would make it a massive file. Meanwhile, all photos would have to be loaded in memory during the loading of the KMZ file.
My question is with the option 2, if a particular photo would not be loaded until the user clicks on the placemark to open the popup balloon OR all the photos are loaded like the option 1?
Thanks!
Cheers,
Alex

You can think of Google Earth as a specialized web browser and the HTML within a given placemark as being handled same way HTML in a web browser is handled. In option 2 the images are not downloaded until user clicks the placemark and the description balloon is selected and starts to render.
Option 1 you have a huge KMZ file as you describe that must be downloaded entirely to the client and unpacked locally. The file may be too large to download in a mobile device if you want Google Earth mobile users to view it. The Google Earth essentially unpack the KMZ then access images as in the case of option 2 when the placemark with that image is selected. Only difference is that the entire collection must be downloaded in one shot so the initial startup time is slower and depends on network speed.

Related

Updating Google KMZ Popup Contents & Removing "Directions" in FME

By default a KML balloon will contain links "Directions to Here" and "Directions from Here" (driving directions).
I want to know, how to remove these links from the balloon using FME, as well as use HTML to set KML Balloon content, URL links and images, such as pngs, jpegs, and tiffs.
Also, I will appreciate if there is a workaround other than FME, to do the same, my objective is to remove the data from google kmz which I don’t need and only want to show that data which is required.
What you will want to end up with in the KML file is a BalloonStyle for your balloon content, which looks like: <BalloonStyle><text>...</text></BalloonStyle>, either shared at the top of the KML file, or inline in each placemark/feature. Your BalloonStyle can contain with either static HTML/Text content for the balloon, or an HTML template that can be filled in with basic data (name, description, etc.) or ExtendedData fields from each feature. When you specify balloon content using BalloonStyle, it will leave leave out the directions info. It will also not include the name at the top of the balloon by defautl, so you may want to include that in your content or template.
For more on KML BalloonStyles, see:
https://developers.google.com/kml/documentation/kmlreference#balloonstyle
and:
https://developers.google.com/kml/documentation/extendeddata
I don't know much about FME, but looks like it's possible to do this using AttributeCreator. For more see these instuctions:
https://community.safe.com/s/article/kml-balloon-contents-removing-directions

how to reduce size of generated gitbook website?

I have project of documentation in gitbook with about of 1000 pages. Result of website generation is set of html files in common size 300 MB. There are 2 causes of such result:
1) All pages listed in SUMMARY.md and as result all generated static htmls has this large menu in 1000 links. The menu is not fully shown thanks to plugin which hides subchapters, but in any case whole menu is inside each html page. If to remove a page link from the SUMMARY.md, the associated html file doesn't generates. Is where any method to generate website with reduce menu (in this case access to subchapters pages will be provided from content of chapters pages)?
2) Big part of the content is not english text, and it translates in sequence of 7-chars codes (like this &#x0123), how to keep native 1-char symbol?
I'm not sure about your second issue, but it sounds like you can segment the menu as you wish, judging from the theming documentation: https://toolchain.gitbook.com/templating/variables.html

<a4j:mediaoutput , loads images slowly? what can be the reason?

I am inspecting a portal's page for loading of images ,its loading very slow.
We pick images from a filesystem , images name from database and read them, create a list and show results using a4j:mediaOutput tag. but the images are being loaded very slowly.
http://www.easyrenting.com/list-detail/3bhk-ardee-city-sector-52/6263
The first problem I see is that all your pictures are high-res (1800px x 2400px).
You really should create thumbnails server side to meet your view requirement and load images according of the size you want to show on the client size.
Have you only verified that your web page weight about 6.5MB including all images? (Check with Firebug).
I would recommand you a custom servlet like this one FileServlet supporting resume and caching with GZIP, and create a URL pattern according to load full res or thumbnail depending of the requirement.
There is no problem using the a4j:mediaOutput tag.
The images are getting loaded slowly because the size is too large, you need to find out a way to optimize the image size. Probably you can re-size the images before saving it to your file system.
Unless you are giving the zoom functionality, you do not need these big images.
That should help!

Using Sprite Image on Google Earth

Currently, I am loading a lot of placemarks on Google Earth on the website I created. Each placemark corresponds on a single file from the server. The placemarks are created one by one by the server coming from different images during initialization.
To ease the load of the server and the client, I am planning to change the implementation I mentioned using sprite image using css. Is this possible in Google Earth? I can't find any information about this. Maybe you can give some reference to do this.
Thank you very much.
Ability to use Image Sprites for Placemark Icons
I think you can do it something like:
ge.getFeatures().appendChild(me.placemark);
me.point = ge.createPoint('');
me.placemark.setStyleSelector(ge.createStyle(''));
var IconStyle = me.placemark.getStyleSelector().getIconStyle();
IconStyle.getColor().set(colour);
IconStyle.getHotSpot().setXUnits(ge.UNITS_FRACTION);
IconStyle.getHotSpot().setYUnits(ge.UNITS_FRACTION);
IconStyle.getHotSpot().setX(0.5);
IconStyle.getHotSpot().setY(0.5);
me.setLoc(lat,lon);
IMHO: if there are thousands of images in the sprite it will load it as many times as the number of placemarks on the map.

Is it possible to animate multiple KML (gpx) routes in Google Earth

I would like to import multiple gpx files into Google Earth & animate them concurrently. I've only been able to animate one at a time.
i have been getting going on sailboat race tracking just like you want.
Progress so far is great -
using smartphones as the .gpx data loggers on each boat ('GPS Essentials' for android and 'MyTracks' (NOT 'Mapmytracks') for iphone, both free.
At the end of the race we email the .gpx files which are imported into GoogEarth via tools/GPS/import. because they are all on satellite time, the concurrence is perfect and automatic.
Each of the tracks appears in the temporary places window, where they can be renamed, path + icon colour changed an so on.
Move (by dragging) each boats file to one folder for this race. Create a "tour" of them and then right click the parent folder to email out a .kmz of the whole show.
spectacular.

Resources