I have an SQLite database with coordinates and tiled up map data/images that I can use to calculate corresponding LatLonBox elements for a GroundOverlay in a KMZ/KML for the Google Earth plugin. I can do the necessary query to determine what images go where on the plugin (aka I can create the GroundOverlay bounds correctly).
Problem:
This is just an example use case, I'm not actually planning on using an OSM map tile - Let's say I downloaded this image:
OSM map tile http://otile1.mqcdn.com/tiles/1.0.0/osm/7/41/79.png
from -> http://otile1.mqcdn.com/tiles/1.0.0/osm/7/41/79.png
and put it into an sqlite database.
Let's say I then calculated the LatLonBox for that image and made a kml file via javascript:
var groundOverlay = ge.createGroundOverlay('');
groundOverlay.setIcon(ge.createIcon(''))
groundOverlay.getIcon().setHref("http://otile1.mqcdn.com/tiles/1.0.0/osm/7/41/79.png");
groundOverlay.setLatLonBox(ge.createLatLonBox(''));
var center = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND);
var north = -38.822591;
var south = -40.979898;
var east = -61.875;
var west = -64.6875;
var rotation = 0;
var latLonBox = groundOverlay.getLatLonBox();
latLonBox.setBox(north, south, east, west, rotation);
ge.getFeatures().appendChild(groundOverlay);
Example KML file:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<GroundOverlay>
<name> 00</name>
<Icon>
<href>http://otile1.mqcdn.com/tiles/1.0.0/osm/7/41/79.png</href>
<drawOrder>0</drawOrder>
</Icon>
<LatLonBox>
<north>-38.822591</north>
<south>-40.979898</south>
<east>-61.875</east>
<west>-64.6875</west>
<rotation>0.0</rotation>
</LatLonBox>
</GroundOverlay>
</kml>
Except instead of the href element pointing to http://otile1.mqcdn.com/tiles/1.0.0/osm/7/41/79.png, I want it to point to the image in my database. It doesn't have to directly point to the image in the database, I can use javascript to get the specific image(s) of interest, but once I have the image data I am lost on what to do.
So I can access the sqlite database with the image of interest in it on my local filesystem via javascript/html5 and parse an almost complete KML file (missing the href element because I don't know how to get the correct href element).
Once I'm at this point, I don't know where to go. How would I display that image on the google earth plugin or is it even possible without hosting it on a server? Is it possible to use javascript to serve up those images (aka act like a server in the browser to link the images in the database to a specific href that can be referenced in a kml document)?
The third element from the answer here makes me think it MIGHT be possible, but since it wasn't tried and it was aimed at serving up a KML file rather than the href element inside the KML file, I have no idea if it even applies.
Can this be done solely with javascript or must the images be hosted somehow/somewhere?