Custom HTML text for KML/KMZ export
Amanda McDermott
Global Mapper UserTrusted User
in User Scripts
I am trying to export to kmz using custom html text, because I want some but not all of the attribute values to show up in the export. I also want an image to show in the pop up in google earth.
If I use either 'Feature Description and links Only' or 'Feature
Description, Links and Attribute Values', the export successfully embeds
the linked image - but doesn't show the text how I want it.
If I use custom html, and include %File_LNK_1% (the attribute name for the image reference), the result comes up with the text of the file link, rather than embedding the image, in the pop up. What am I doing wrong please?!
Answers
-
Hello Amanda,
Since you are using custom HTML, you probably need an image tag. Here is a sample:<img src="%File_LNK_1%" alt="My Image Attr">
This will replace the src parameter with the text of the File_LNK_1 attribute. If you need more information about the img tag, you can look here.
Cheers,
Bob -
Thanks Bob - afraid that just seems to remove the file path text, but doesn't show the image... I want to embed the images in the .kmz file, in the same way as the export without custom html does it?
-
Hi Amanda,Amanda McDermott said:Thanks Bob - afraid that just seems to remove the file path text, but doesn't show the image... I want to embed the images in the .kmz file, in the same way as the export without custom html does it?
Can you post a small example KMZ with the images embedded correctly? If I have some time, I will take a look to see how the images are referenced.
In addition, you ought to contact the Blue Marble Support team via email (geohelp@bluemarblegeo.com). Please include a detailed description of your work flow, and sample data that illustrates what you are trying to do. There are likely to have insights into how you might be able to make this work.
Cheers,
Bob -
Thanks Bob,I don't seem to be able to attach .kmz files here, keeps saying 'file is not allowed'? One of them is only 6kb, so it can't be a size thing, any ideas?I'll email the support team as well.all the best,Amanda
-
Amanda McDermott said:I don't seem to be able to attach .kmz files here, keeps saying 'file is not allowed'? One of them is only 6kb, so it can't be a size thing, any ideas?
I suggest renaming your file to *.zip (for example, mydata.kmz.zip -- it is actually a zip file, anyway). That should allow it to be attached.
Cheers,
Bob -
Done, thanks! See attached:
ExportWithPhotos-test.zip = export using Feature Description, Links, and Attribute Values
ExportWithPhotos-testCustomHTML.zip = export using my original custom HTMLExportWithPhotos-testCustomHTML-src.zip = export using edited html belowYour suggestion did give me a starting point for a workaround option I think would work, where I can edit the source code of the resulting kmz with no image showing, to refer to an online location with the photos, but I haven’t tested it. I would prefer to just be able to spit out something like ExportWithPhotos-test.kmz, but with only the fields I want showing as text. I then feel confident that I know how to edit the source code to refer to the photos hosted online (I don’t think it’s an option to ‘truly’ embed them? That would be the ideal.)<BalloonStyle id="ID">
<text>
<b>
%Name% </b>
\n
<img src="%File_LNK_1%">
\n
<b>Suggested Intervention/s:</b> %intervention 1%, %intervention 2%, %intervention 3%
\n
<b>Estimated Volume:</b> %Est Volume% m³
\n
<b>Notes:</b> %Notes%
\n
<b>OS Grid Reference:</b> %gridref%
\n
</text>
</BalloonStyle>
-
Hi Amanda,
Here is another workaround that will at least make it so you don't have to edit the KML source. Keep working with the support team, and if they don't have a solution, they will add an item to our task list so we can take care of this situation.- Create a new attribute for each feature, and put set its value to the file name relative to the KML file. For example, FILE2="files/b-test-photo.jpg".
- In your custom HTML, use <img <img src="%FILE2%"></img>
Bob -
Thanks Bob, for being so helpful and responsive, as usual!
Categories
- 12.8K All Categories
- 5.7K Features Discussion
- 346 Downloading Imagery
- 1.3K Elevation Data
- 385 Georeferencing Imagery Discussion
- 639 GM Script Language
- 54 User Scripts
- 115 GPS Features
- 417 Projection Questions
- 829 Raster Data
- 1.3K Vector Data
- 6.6K Support
- 178 Announcement and News
- 920 Bug Report
- 559 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 573 Other Discussion
- 131 GIS Data Sources
- 27 Global Mapper Showcase
- 241 How I use Global Mapper
- 108 Global Mapper Forum Website