I'm trying to put an icon in a KMZ file so the user can view a thumbnail when they click on the pinpoint. I have the following code - It's working, but isn't showing the icon/thumbnail. I've looked at the Google Developers and can't see a difference. Just need a second pair of eyes to view it.
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Placemark>
<name>Evidence File</name>
<description>SAMSUNG - GT-I9000
2012:10:25 17:36:57
2797 KB
Height: 2448 Pixels
Width: 3264 Pixels
C:\Users\Steve\Desktop\FYP Cases\M2510\IMG_20121025_163656.jpg</description>
<IconStyle><scale>1.1</scale><Icon><href>C:\Users\Steve\Desktop\FYP Cases\M2510\IMG_20121025_163656.jpg</href></Icon></IconStyle>
<Point>
<coordinates>-2.6172222222222223,51.43</coordinates>
</Point>
</Placemark>
</kml>
You have an absolute reference to the file in your KML file (C:\Users\Steve...). If image is inside your KMZ then you should reference the relative file location instead. Also, the file path C:... is not a valid URL which should be of the form http:// or file:// if using an absolute URL.
Let's assume the KMZ file has two entries (in this order):
doc.kml
IMG_20121025_163656.jpg
The IconStyle within the doc.kml should be rewritten like this:
<IconStyle>
<scale>1.1</scale>
<Icon>
<href>IMG_20121025_163656.jpg</href>
</Icon>
</IconStyle>
Related
I have a KML file containing placemarks with custom icons.
When viewed in Google Earth the anchor point is center of the icon. Like this ...
When the KML file is viewed in Google Maps on my website, the anchor point changes to be the bottom center of the icon. Like this ...
Why is this? And how do I change it so that when loaded by Google Maps API the anchor point is in the center of the icon?
Here is the styling in the KML file ...
<Style id="Parking">
<IconStyle><Icon><href>http://www.virtualmountains.co.uk/shared/Parking.png</href></Icon></IconStyle>
<BalloonStyle>
<text>$[description]</text>
<bgColor>white</bgColor>
<text><![CDATA[
<font color="#674A32" face="arial" align="justify">$[description]</font>
]]></text>
</BalloonStyle>
<LabelStyle>
<color>FFFFFFFF</color>
<scale>0.8</scale>
</LabelStyle>
</Style>
Here's the placemark code ...
<Placemark>
<name>A5 Parking, Tryfan</name>
<description>
<![CDATA[
<DIV style="max-width:400px; margin-right:10px; margin-bottom:10px; color:#674A32; font-family:Arial">
<DIV style="font-size:11pt; font-weight:bold; text-align:left">A5 Parking, Tryfan<BR></DIV>
<DIV style="font-size:10pt; text-align:justify"><BR>
There is a parking here alongside a great length of the A5.
</DIV>
</DIV>
]]>
</description>
<styleUrl>#Parking</styleUrl>
<Point><coordinates> -3.991196, 53.125136,0</coordinates></Point>
</Placemark>
You can specify the anchor point or "hotspot" for a Placemark's icon in the KML as part of the <IconStyle>. The <hotspot> tag allows you to specify the anchor point on the icon either using fraction (0 to 1) or pixel dimensions, in the x (left/right) and y (up/down) directions.
For example, if you want to make your icons anchor in the center of each one, you would make your IconStyle look like this:
<IconStyle>
<Icon>
<href>http://www.virtualmountains.co.uk/shared/Parking.png</href>
</Icon>
<hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction">
</IconStyle>
That should work for KMLs both in Google Earth and in Google Maps.
You can find the documentation for the <hotspot> tag in the KML reference, here: https://developers.google.com/kml/documentation/kmlreference#hotspot
My placemark icon, used via HREF from google mapfiles, seems to "drift" when I zoom out. In this example the placemark can make it all the way up to Norway.
It seems that Bing maps V8 doesn't support the kml which supposedly could help the icon to understand where its center is so that it would stay anchored in the map during zooming out. Additionally, the placemark is ignoring the color style. If I remove the everything between the tags and just use the default placemark from Bing, the colors and zoom work correctly. Do any of you know of a way to get this Google icon to stay anchored via KML in Bingmaps? My current workaround is simply not to use the Google icon, and instead use the default Bing maps icon, which works. Using code to do it on the bingmaps object would require too much refactoring at this time.
You can use the Bing "drag and drop" here with my code to see the problem - just paste the KML below into the "XML Panel" and click "Read XML". Then zoom out to see the placemark go traveling. If you remove the whole node, the zoom and colors work (but with the default icon).
https://bingmapsv8samples.azurewebsites.net/#GeoXml%20-%20Drag%20and%20Drop
<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Style id="model_normal">
<IconStyle>
<color>FF00FF00</color>
<scale>1</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/shapes/shaded_dot.png</href>
</Icon>
<hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction" />
</IconStyle>
<LabelStyle>
<color>0000FF00</color>
</LabelStyle>
<LineStyle>
<color>7F00FF00</color>
<width>3</width>
</LineStyle>
<PolyStyle>
<fill>1</fill>
<color>7F00FF00</color>
</PolyStyle>
</Style>
<Placemark>
<name>Example placemark</name>
<description></description>
<visibility>1</visibility>
<styleUrl>#model_normal</styleUrl>
<MultiGeometry>
<Point>
<coordinates>7.003930,53.361905</coordinates>
</Point>
</MultiGeometry>
</Placemark>
</kml>
The anchor format that Bing Maps expect is in pixels, so you can update the hotSpot in IconStyle to:
<hotSpot x="32" y="32" xunits="pixels" yunits="pixels" />
By default custom pushpins on Bing Maps are anchored at bottom center - that's why the "shifting" is observed.
This code worked perfectly until a short time ago. The KML and the Javascript certainly haven't changed so I'm imagining I have some issue in the KML which a Google update now doesn't like.
I have a Google Maps API implementation which simply loads a KML file into a KMLLayer on a map. Now, I get the Linestrings displaying but not the points.
Here is the relevant snippets from the KML.
<Style id="start">
<IconStyle>
<scale>0.0</scale>
<heading>0.0</heading>
<Icon>
<href>http://d1b3rm3ifop01h.cloudfront.net/mapicons/start-race-2.png</href>
<refreshInterval>0.0</refreshInterval>
<viewRefreshTime>0.0</viewRefreshTime>
<viewBoundScale>0.0</viewBoundScale>
</Icon>
</IconStyle>
</Style>
...
<Placemark>
<name>Baden Powell Horseshoe Bay Trailhead</name>
<description>Elevation: 54.9 m (180.2 ft)<br />Very small carpark only accessible travelling north.<br /><a href="http://www.trailhunger.com/junction/820">Junction Information</a></description>
<styleUrl>#start</styleUrl>
<Point>
<coordinates>-123.2749314141,49.3669179082,54.93</coordinates>
</Point>
</Placemark>
The problem was that the scale element was set to 0.0 and Google very recently changed their Google Maps KML parser to honour the scale element. Setting it to 1.0 made the icons appear.
0.0 is the default for the de.micromata.opengis.kml libary I'm using.
The next problem was that the icons were appearing in the wrong position. This was because I needed the hotSpot element to be specified.
This answer was provided by geocodezip#gmail.com on the Google Maps API issue I raised.
Thanks in advance.
I'm a graphic designer.
I have to make a widget that shows some icons.
I've made an icon that starts in systemtray, all I need is to make the window application that start at bottom over the icon.
I don't know anything about flex...
I've done this so far in application.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<application xmlns="http://ns.adobe.com/air/application/1.0">
<id>com.widgetStatus.widgetStatus</id>
<filename>widgetStatus</filename>
<name>widgetStatus</name>
<description>Test</description>
<version>0.1a</version>
<initialWindow>
<content>html/index.html</content>
<title>widgetStatus</title>
<systemChrome>none</systemChrome>
<transparent>true</transparent>
<visible>true</visible>
<minimizable>false</minimizable>
<resizable>false</resizable>
<width>400</width>
<height>300</height>
<x>1268</x>
<y>646</y>
</initialWindow>
<icon>
<image128x128>/icons/widget128.png</image128x128>
<image48x48>/icons/widget48.png</image48x48>
<image32x32>/icons/widget32.png</image32x32>
<image16x16>/icons/widget16.png</image16x16>
</icon>
The application starts over the systray but only with my resolution obliuvsly.
Now I need to do something like that:
Positioning Flex/AIR Desktop App Window to the bottom right corner
How can I work with that script in flex? I understand that I can put the code into xml.
Thanks.
iam writing a simple firefox toolbar, but i have failed to set a few list style images with css. Please help.
//
katimbatoolbar.css
(found in chrome/skin) folder
#katimbatoolbarstart
{
list-style-image :url("chrome://katimbatoolbar/skin/button-1.png");
}
katimbatoolbar.xul (my user interface file, found in "chrome/content/" folder)
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://katimbatoolbar/skin/tuttoolbar.css" type="text/css"?>
<overlay id="katimbatoolbaroverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript"
src="chrome://katimbatoolbar/content/katimbatoolbar.js" />
<toolbox id="navigator-toolbox">
<toolbar id="katimbatoolbar" toolbarname="katimba suite" accesskey="k"
class="chromeclass-toolbar" context="toolbar-context-menu"
hidden="false" persist="hidden">
<toolbarbutton id="katimbatoolbarstart" tooltiptext="start surfing using katimba ++"
label="Start" oncommand="katimbaClass.installLocalHost()"/>
</toolbar>
</toolbox>
</overlay>
Here is my chrome.manifest file
content katimbatoolbar chrome/content/
overlay chrome://browser/content/browser.xul chrome://katimbatoolbar/content/katimbatoolbar.xul
skin katimbatoolbar classic/1.0 chrome/skin/
The toolbar works fine, but really looks ugly since the css is not working. Any help appreciated in advance.
By the way, Here is my folder structure
mytoolbar/
install.rdf
chrome.manifest
chrome/
content/
katimbatoolbar.xul
katimbatoolbar.js
skin/
katimbatoolbar.css
button-1.png
In your XUL file you reference chrome://katimbatoolbar/skin/tuttoolbar.css while the file in your folder structure is called katimbatoolbar.css. Plus, you define
content katimbatoolbar chrome/content/
but the folder structure starts with mytoolbar.