Custom HTML text for KML/KMZ export

Amanda McDermottAmanda McDermott Global Mapper UserPosts: 69Trusted User
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?!




Tagged:

Answers

  • bmg_bobbmg_bob Global Mapper Programmer Posts: 2,002
    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
  • Amanda McDermottAmanda McDermott Global Mapper User Posts: 69Trusted User
    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?
  • bmg_bobbmg_bob Global Mapper Programmer Posts: 2,002
    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,

    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
  • Amanda McDermottAmanda McDermott Global Mapper User Posts: 69Trusted User
    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
  • bmg_bobbmg_bob Global Mapper Programmer Posts: 2,002

    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? 
    Hi Amanda,

    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
  • Amanda McDermottAmanda McDermott Global Mapper User Posts: 69Trusted User
    Done, thanks! See attached:

    ExportWithPhotos-test.zip  = export using Feature Description, Links, and Attribute Values
    ExportWithPhotos-testCustomHTML.zip  = export using my original custom HTML
    ExportWithPhotos-testCustomHTML-src.zip  = export using edited html below

    Your 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.)

    My edited ‘custom html’ text now reads as follows;

    <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>





  • bmg_bobbmg_bob Global Mapper Programmer Posts: 2,002
    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.
    1. 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".
    2. In your custom HTML, use <img <img src="%FILE2%"></img>
    Cheers,
    Bob
  • Amanda McDermottAmanda McDermott Global Mapper User Posts: 69Trusted User
    Thanks Bob, for being so helpful and responsive, as usual!
Sign In or Register to comment.