I know that is possible to display a URL link inside a kml using IFRAME.
But I need that my link used on IFRAME does not display if I do right-click -> Properties in the placemark or in the right list of placemarks.
There's a way to do so?
Thx a lot,
Cya!
Yes you can
You need to look into using ExtendedData
It requires you to hand edit the KML file with a text editor.
Step 1 - Within the <Placemark> you wish to embed to iframe
<ExtendedData>
<Data name="iframe">
<value><![CDATA[<iframe width="350" height="197" src="http://www.google.com"></iframe>]]></value>
</Data>
</ExtendedData>
Step 2 - Within the associated <Style> assigned to the Placemark
<BalloonStyle>
<text>$[description]$[iframe]</text>
</BalloonStyle>
That will work so long as you place everything in the correct place
HOWEVER anyone who really wants to see the source of your iframe - all they have to do is open the KML in a text editor..... so it is kind of a useless process......
Related
I want to draw custome text inside polygon using KML file.
My Kml file for Polygon-
<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Style id="White"><PolyStyle><color>64FFFFFF</color></PolyStyle></Style><Placemark><styleUrl>#white</styleUrl><Polygon><outerBoundaryIs><LinearRing><coordinates>-95.27999999999997,30.0175 -95.27166999999997,30.0175 -95.27166999999997,30.01083 -95.27999999999997,30.01083 -95.27999999999997,30.0175</coordinates></LinearRing></outerBoundaryIs></Polygon><ExtendedData><Data name="isColorful">true</Data><Data name="color">white</Data></ExtendedData></Placemark></Document></kml>
am i missing any tag or property to show text in the center of polygon.
Please help.
Actually , I want to show some data inside polygon, I created KML using with Point and polygon.
-I made icon scale 0 to hide icon .
it shows name label inside polygon in "Google Earth", but it does not show label in "Google map".
Please see my sample KML file
<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Style id="White"><IconStyle> <color>ff00ff00</color> <colorMode>random</colorMode><scale>0</scale></IconStyle><LabelStyle><scale>0.6</scale></LabelStyle><PolyStyle><color>64FFFFFF</color></PolyStyle></Style><Placemark><name>64,100</name><styleUrl>#White</styleUrl><MultiGeometry><Point><coordinates>-95.27899999999997,30.0172</coordinates></Point><Polygon><outerBoundaryIs><LinearRing><coordinates>-95.27999999999997,30.0175 -95.27166999999997,30.0175 -95.27166999999997,30.01083 -95.27999999999997,30.01083 -95.27999999999997,30.0175</coordinates></LinearRing></outerBoundaryIs></Polygon></MultiGeometry></Placemark><Placemark><name>65,93</name><styleUrl>#White</styleUrl><MultiGeometry><Point><coordinates>-95.27066999999997,29.97053</coordinates></Point><Polygon><outerBoundaryIs><LinearRing><coordinates>-95.27166999999997,29.97083 -95.26333999999997,29.97083 -95.26333999999997,29.96417 -95.27166999999997,29.96417 -95.27166999999997,29.97083</coordinates></LinearRing></outerBoundaryIs></Polygon></MultiGeometry></Placemark></Document></kml>
Some of the elements in the KML are out of order making it invalid KML with respect to the KML 2.2 specification. The KML should first be validated. Some tips to validate KML are discussed here.
The ExtendedData element is incorrect. Missing required value element.
<ExtendedData>
<Data name="isColorful">true</Data>
<Data name="color">white</Data>
</ExtendedData>
This need to be restructued:
<ExtendedData>
<Data name="isColorful">
<value>true</value>
</Data>
<Data name="color">
<value>white</value>
</Data>
</ExtendedData>
If KML placemark has ExtendedData then these data fields are formatted in a human readable HTML table in the description balloon popup when clicked.
If you want to override the HTML table then add a <description> to your KML placemark which can contain HTML markup. See description section in KML reference docs.
UPDATE:
If want text to appear on the polygon then need to include Point and Polygon in MultiGeometry as you describe but also need a <name> element added to the Placemark. The text of the name element will be the label that is displayed at the position of the point. This works in Google Earth but not in Google Maps. KML has some limitations in Google Maps. If want to add text to center of your polygon, then add a label marker via Google Maps API.
https://developers.google.com/maps/documentation/javascript/examples/marker-labels
I have a kml file with many simple point placemarks each with a name that cover the USA. I am trying to find a way to control their label display so that the view is not cluttered at higher altitudes. I've seen mention the use of Regions but it appears this would have to be applied on each placemark. I know something must be available for this since GE is doing this very thing on the default layers, i.e. Populated Places. Further, there seems to be some default at work when I zoom far enough out the labels disappear without any input on my kml.
Any comments are appreciated!!
To control the display of labels in your KML you can either use Regions as you mentioned and/or a StyleMap with a normal and highlighted LabelStyle.
If you capture the HTTP traffic to Google Earth you'll notice the Borders and Labels default layer (among others) are implemented as KML files using Regions and nested NetworkLinks.
Regions
If you don't want to create a Region on every placemark then you could group your placemarks into folders and have a Region on the folder to control when placemarks are visible. Creating the regions correctly takes some trial and error. You may not even need to specify the min/max altitude -- an appropriate minLodPixels value to the region dimensions may be enough.
A tutorial on Regions can be found here.
https://developers.google.com/kml/documentation/regions
StyleMap
You may want to create a StyleMap where the normal Style has a LabelStyle with a scale of 0 to suppress the labels entirely or a smaller value to simply reduce the clutter.
<Style id="sn_style">
<LabelStyle>
<scale>0</scale>
</LabelStyle>
</Style>
<Style id="sh_style">
<LabelStyle>
<scale>1.1</scale>
</LabelStyle>
</Style>
<StyleMap id="msn_style">
<Pair>
<key>normal</key>
<styleUrl>#sn_style</styleUrl>
</Pair>
<Pair>
<key>highlight</key>
<styleUrl>#sh_style</styleUrl>
</Pair>
</StyleMap>
Had the Same Problem and I couldn't find any quick solution for the as my .kml contained almost 10k POI's. So what I did was adding the code offered by the FAQ, so my header would look like this:
<?xml version="1.0" encoding="utf-8" ?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document><Folder><name>name</name><Style id="hideLabel"><LabelStyle><scale>0</scale></LabelStyle></Style>
And I changed the first placemark to this:
Placemark>
<name>name</name>
<styleUrl>#hideLabel</styleUrl>
<ExtendedData><SchemaData schemaUrl="#name">
<SimpleData name="Name">name</SimpleData>
<SimpleData name="Latitude">xxxx</SimpleData>
<SimpleData name="Longitude">yyyy</SimpleData>
</SchemaData></ExtendedData>
<Point><coordinates>xxxx,yyyy</coordinates></Point>
</Placemark>
After that I loaded the .kml into Google Earth and right-clicked onto it to select Properties. Select "Style, Color" tab and it should state the following:
The descendant(s) of this folder do not share the same Style. Click
the button below if you want to force all descendants to share the
same Style
Click the button below "Share Style" and it will temporarily hide all the labels.
Kind regards,
Thomas
My KML placemarks have the description element populated as such
<description>
<![CDATA[
some text
someTag
]]>
</description>
With Google Earth 5, when you click on the link in the balloon, the kml is downloaded and displayed as expected.
With Google Earth pro 6, when you click on the link in the balloon, nothing happens. You have to right click on the link and then select "Open in New Window". Then the KML is downloaded and displayed in Google Earth.
Does anyone know why there is the behavoir difference between GE 5 and GE6? How do I get links in kml balloons to download in GE6 without requiring the right click workaround
There were some updates to handling URLs and hrefs between GE 5 and 6. GE 5 allowed some sloppy URLs and 6.0 became stricter in a few places to better conform to the specs. There weren't a lot of details on the specifics. Check the syntax of the URL and make sure it opens in your web browser.
Note if you want to fly-to a target Placemark in another KML file you specify the id of that Placemark as an anchor in the URL with a "#" followed by the id (see example below in second link).
Here's a KML example that works in GE 6.2.2:
<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Placemark>
<name>Test</name>
<description>
<![CDATA[
test URL#1
<P>
test URL#2 w/anchor
]]>
</description>
<Point>
<coordinates>-123.0821604290386,37.42041505714916</coordinates>
</Point>
</Placemark>
</kml>
I want to display multiple jpg(s) and/or pdf file(s) to a single placemark. The file path is in my company's directory and I would like anyone in the company that I send this google earth file to have the ability to view each placemark.
I have tried the command and neither seem to be working.
Both of these commands work with images at a "http:// address" but not with references to my hard drive nor server.
A KML Placemark can contain any number of images in its description. Most HTML will render inside the description of any given Placemark.
Option 1. Linking to a PDF or other media via URL within KML
Here's sample KML file to launch in Google Earth which will show an inline image in the popup balloon with a link to a PDF file:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2">
<Placemark>
<name>Test</name>
<snippet/>
<description>
<![CDATA[<a href="http://stlab.adobe.com/wiki/images/d/d3/Test.pdf"><img
src="http://stlab.adobe.com/wiki/skins/common/images/icons/fileicon-pdf.png"></a>
]]>
</description>
<gx:balloonVisibility>1</gx:balloonVisibility>
</Placemark>
</kml>
Note the gx:balloonVisibility tag which if set to "1" will auto-display the popup. That's a useful feature.
If images are within your hard-drive then you won't be able to share the KML with others unless you either bundle the images inside a KMZ file or publish the images to web site in your company so they are accessible via a URL.
Option 2. Embed the PDF within the Placemark description balloon
One trick to directly embed the PDF within the Placemark description balloon is using the Google PDF viewer in an iframe and substitute the test URL for actual URL in link below.
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Placemark>
<name>Test</name>
<snippet/>
<description>
<![CDATA[
<iframe src="http://docs.google.com/gview?url=http://stlab.adobe.com/wiki/images/d/d3/Test.pdf&embedded=true"
style="width:718px; height:700px;" frameborder="0"></iframe>
]]>
</description>
</Placemark>
</kml>
This technique doesn't need a Flash player and works in Google Earth.
Note if you do this too many times and/or try for very large documents then the viewer will display the message:
You've reached the bandwidth limit for viewing or downloading files that aren't in Google Docs format. Please try again later.
I was wondering if someone could help me out with Sharepoint 2007. What I want to do is to add a custom menu item to a context menu (the menu that opens when you click a document or another item).
Right now, the menu looks like this:
picture
I want to add an item, "Do stuff" for example, to this menu. Major problems:
I wish this item to appear only in menus for a certain file type (e.g. only for .html but not for .doc);
When I click this item ("Do stuff"), I want to call custom external code (written in C#, either an exe or a DLL), which accepts the name of the clicked file as an input parameter.
I understand the way to achieve this is by using Custom Actions (no javascript editing required in 2007, right?). But since I'm quite new to MOSS, I'm a bit lost and not sure what exactly to do and where to start, so any help is greatly appreciated.
You have to implement a CustomAction like this:
<CustomAction
Id="YourUniqueId"
Location="EditControlBlock"
RegistrationType="FileType"
RegistrationId="html"
Sequence="20"
Title="The text you want">
<UrlAction Url="~site/_layouts/company/ActionPage.aspx?List={ListId}&ID={ItemId}" />
</CustomAction>
What you put in the Url of UrlAction depends on what you want to do. It can be JavaScript or the url of a Page or Handler.
In my example it's a Page which gets the QueryParameters so that SPContext.Current.ListItem will contain the selected documents listitem.
<?xml version="1.0" encoding="utf-8"?>
<Elements Id="d0574a32-59ce-4561-9496-ccf17da37a35" xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction Id="Test2"
Location="EditControlBlock"
RegistrationType="FileType"
//docx = documents, txt = text files, html = html files**
RegistrationId="docx" Sequence="10"
Title="View Item Properties">
<UrlAction Url="~site/_layouts/WSSHOL/ViewPageRedirect.aspx?listid={ListId}&itemid={ItemId}" />
</CustomAction>
</Elements>