Local images are not appearing in kmz - kml

I have information bubble in kml, which shows image along with some data.
That image is a local image which comes from respective folders. I have added a "file" addition before image src path , now i am able to see images on placemark in kml file.
But when I convert this kml file to kmz those images on bubbles are not appearing.
Can any one help me regarding this??
Cheers
Praveen.

Here is an example KMZ file with an image in the infowindow, which works using KmlLayer in the Google Maps API v3 (can't seem to embed the link, so it is below):
KmlLayer
geoxml3
and using Google Maps (no longer supported)
The image is embedded in the KMZ.
The KMZ documentation states:
They can refer to files within the same KMZ file, or to files contained in other KMZ files or stored elsewhere on the web.
Your File:/// reference is not "on the web".
It also states:
However, if you use absolute references to local files, the links will break when the files are moved to a new system. Relative references avoid this problem.

Related

Is there any way to convert ..PNG image to .DWG file & how to get manifest file along with converted .DWG for drawing_package in azure maps indoor?

Prerequisites
To create indoor maps:
=>Make an Azure Maps account
=>Obtain a primary subscription key, also known as the primary key or the subscription key.
=>Create a Creator resource
=>Download the Sample Drawing package.(https://learn.microsoft.com/en-us/azure/azure-maps/tutorial-creator-indoor-maps)
Requirement: 1). I have sample .PNG image. I wanna convert this to .DWG and After conversion , I should be able to edit data in .DWG Is it possible ??
2). As you see above azure maps team provided some sample "Sample Drawing Package" for indoor map. This package you can download from the above link. If you download and open, there you can see 3 .dwg files (Basement.dwg,Ground.dwg, Level_2.dwg) along with manifest.json file.
So, How can I generate my own manifest.json file relates to converted
(.PNG to .DWG) file?
NOTE:
I have used https://www.reaconverter.com/convert/png_to_dwg.html and https://www.3ds.com/products-services/draftsight-cad-software/download-draftsight/?wockw=Draftsight for converting .png to .dwg
Sample png file : Floor03 Vertical.png,
After conversion dwg file : ConvertedFile.dwg
So, I request anyone suggest how can I get my own (conversion .png to .dwg) drawing_package along with manifest.json data ?
You will need to manually define your own manifest.json file. CAD tools are what architects use to design buildings. Another way to create a map is to use MS Graph. A script would have to be written to output the manifest.json, so that is something you would have to write.
If you would like to make a feature request please do it in https://feedback.azure.com/forums/909172-azure-maps and share here so others can vote.
The manifest.json is used to describe the DWG file for conversion to an indoor map. This file isn't automatically generated. Please see Drawing Requirements for additional details.

Easily differentiate video files from image files in Node

I'm building a project where people can upload files, I would like to then display those files in a browser where people can interact with them (vote, comment etc)
However, this means I need to programatically build the html depending on the format of the video or image. Is there a way to feed a file (or filename) into a library, and determine whether I need to display it in a video element or an image element? Even a list of video formats vs image formats would help but I haven't seen anything in regards to that.
No module can reliably determine the file type. The user could either change the extension or even the magic number of the file to obfuscate it. The only reliable way it to try to pass file to some image / video transcoder to let it decide or error out if the format is invalid. This way you know you are working with known formats since all files are transcoded to your specific extensions. That could be mp4 or png. I recommend using handbrake for videos and sharp for images. Leaving the NPM links down below:
https://www.npmjs.com/package/handbrake-js
https://www.npmjs.com/package/sharp

Loading Google Maps from a kml file on server

My website (www.boatingtrax.com) presents maps from google earth and google maps. I prepare the kml files and load the file to my server. I put links to the various kml files on my site (https://www.boatingtrax.com/notices-to-mariners/news-south-wales-notices-mariners/) and google earth formats are generated. NICE!
I update the kml files daily and a new google earth map is generated.
Google Maps is different. I can produce a google map using the kml file and embed the map on site or share the link Both work well. Also nice!
But I have to do that every time I change the kml files (which is daily). Painful!
Could anyone point me to a process so that I can keep Google Maps updated automatically?
Any help appreciated.
If I understand correctly, your issue is that every time you upload a new KML, it has a new filename, and therefore you need to change your Maps API code to point at the new file each time?
If so, you should probably check out KML Network Links. A KML NetworkLink is a small KML file that contains a pointer to another KML file.
In your case, what I would do is create one NetworkLink KML with a static filename, which always points at your latest data KML. Have your Maps API code load the NetworkLink file, and it will show the target KML. Each time you add a new data KML, you just have to upload a new copy of the NetworkLink KML (with the same filename), which points at the new data KML.
For details on KML Network Links, see these resources:
KML Tutorial - Network Links
KML Reference - NetworkLink
A few things to note... Maps API has some caching of KML files built in, so there may be a delay (minutes?) from when you update the NetworkLink file to when you see the new data on your map. Google Earth supports long strings of nested NetworkLinks, but Maps will only follow a limited number of NetworkLinks (10, I think?), so be careful if you go down the road of nesting them. Also, Google Maps API does not support all the KML elements which Earth does... details here.

Given a list of image names, how can I search my local website file contents for the image names?

My goal is to remove the image files from a website that are not used by any website files (html, css, js, etc).
I was able to export a list of all image file locations using the answer here: https://superuser.com/questions/324882/export-windows-7-search-results-to-a-text-file
I have a text file with a list of images, such as:
/images/photos/foo.jpg
/images/icons/bar.png
/images/banners/baz.gif
How can I search the file contents of all html, CSS and JavaScript files on my local copy of the website for the image names on my list (above) and return a new list of images that are not found?
I'm using Windows. Is there a batch process or Node.js technique that could be used?

KML relative URL warning

I have this little piece of KML code which shows an image when clicked on the placemark, all images i have are store locally, and it works fine when using the .kml file it self.
Once the file is compressed into .kmz i'll get a warning (yellow marked) on the first line of the CDATA, covering some of my text.
It says: "This balloon may be using incorrectly formatted image URL"
All of my images works fine, they are not missing, and the relative URL is correct, but the syntax is not.
Anyone out there know of a solution to get rid of that hardcoded message ? or even better how to "tune" the code, so this warnings don't show :)
I've seen a couple of examples, stating it should help, but none suits my need, unfortunally.
This was some of the solutions i've looked at, but still not got it working.
Option 1: Fix the URLs
Your base URL is one directory down from where you thought it was, so you can simply add “../” to the beginning of each offending relative URL. This works fine in earlier versions of Google Earth as well, because older versions will look in both directories (and as a bonus, your content will render faster in older versions).
To fix the above example, we’d change:
<img src="images/image.png”>
to
<img src="../images/image.png">
Option 2: Add a <base> tag
As with any other browser, you can add a <base> tag to your HTML to set the base URL of that content. The href parameter of the <base> tag must be an absolute URL, so you’ll have to hard-code your server name and path. Adding the <base> tag to your BalloonStyle can fix all of your URLs in one go.
To fix the above example, we’d add: <base href="http://host.example.com/kmz/somelayer/"> to the BalloonStyle (or description, if we only have a few affected placemarks).
Option 3: Move the files
If you can’t change the balloon content, you can still correct it by moving the resources it points to into the correct locations. Depending on the URL, there are a couple of ways to do this. In our example, you’d move or copy the “images” folder and its contents to the KMZ archive. If the offending URL was “../files/another_image.png” (which should have been “../../files/another_image.png”), you could move or copy the files folder into the somelayer folder to fix the problem.
In many cases, though, there will be many layers all referencing the files folder, so moving the files folder into each layer folder can get tedious. If you have access to the web server configuration, you can solve this by adding an HTTP redirect from each incorrect location that redirects up a directory. You could also move the KMZ file up a directory, but this will change the URL that people must use to access your KMZ file.
I wanted to look at your KML to see if it was properly formatted and test it on my end.

Resources