KML Document inside Document - kml

I recently came across a KML file that had a <Document> inside a <Document> (Actually a Document inside a Folder inside the root Document). Since a Document is a Feature this seems to be valid, but is this semantically acceptable? I am parsing KML in my app, should I accept it or reject it?

Both the Document and Folder elements in KML are container types and it is perfectly valid to have a Document inside a Document, Document inside a Folder, Folder inside a Document, etc. In nearly all cases the Folder and Document can be used interchangeably.
Conceptually it makes sense for "Folders" to have "Documents" inside them but there is no such restriction with KML Folders or Documents. The only semantic difference between a Document and a Folder within the KML 2.2 Specification is that only the Document can have a Schema element or Shared Styles as child elements and the Folder cannot. Other than this the Folder and Document are the same.
Here's the syntax summary description of "Folder" and "Document" elements from KML Reference:
<Folder id="ID">
<!-- inherited from Feature element -->
<name>...</name> <!-- string -->
...
<ExtendedData>...</ExtendedData>
<!-- specific to Folder -->
<!-- 0 or more Feature elements -->
</Folder>
<Document id="ID">
<!-- inherited from Feature element -->
<name>...</name> <!-- string -->
...
<ExtendedData>...</ExtendedData>
<!-- specific to Document -->
<!-- 0 or more Schema elements -->
<!-- 0 or more Feature elements -->
</Document>

Related

How to draw custome text inside polygon in KML?

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

The images do not show on page after publishing the web-application on IIS

The images do not show on page after publishing the web-application on IIS.
When I run the web-application from Visual Studio 2015, the pictures are appear correctly.the path of image is like
/media/1713/mypicture.png
But after publishing the web-application on IIS and run it, the pictures do not show.
But when I add manually the domain at first of above path, the image show correctly. same as
/domain-name/media/1713/mypicture.png.
I've used Umbraco 7.4.3, ASP.NET MVC, VS2015 and Windows 10.
EDIT: I UPGRADED IT TO UMBRACO 7.5.4 BUT STILL THERE IS THE PROBLEM.
:(
How can I solve this problem? Please help me.
umbracosettings.config:
<?xml version="1.0" encoding="utf-8" ?>
<settings>
<content>
<errors>
<error404>1</error404>
</errors>
<notifications>
<!-- the email that should be used as from mail when umbraco sends a notification -->
<email>your#email.here</email>
</notifications>
<!-- Show property descriptions in editing view "icon|text|none" -->
<PropertyContextHelpOption>text</PropertyContextHelpOption>
<!-- The html injected into a (x)html page if Umbraco is running in preview mode -->
<PreviewBadge>
<![CDATA[<a id="umbracoPreviewBadge" style="position: absolute; top: 0; right: 0; border: 0; width: 149px; height: 149px; background: url('{1}/preview/previewModeBadge.png') no-repeat;z-index: 9999999;" href="#" OnClick="javascript:window.top.location.href = '{0}/endPreview.aspx?redir={2}'"><span style="display:none;">In Preview Mode - click to end</span></a>]]></PreviewBadge>
<!-- Cache cycle of Media and Member data fetched from the umbraco.library methods -->
<!-- In seconds. 0 will disable cache -->
<UmbracoLibraryCacheDuration>1800</UmbracoLibraryCacheDuration>
<!-- How Umbraco should handle errors during macro execution. Can be one of the following values:
- inline - show an inline error within the macro but allow the page to continue rendering. Historial Umbraco behaviour.
- silent - Silently suppress the error and do not render the offending macro.
- throw - Throw an exception which can be caught by the global error handler defined in Application_OnError. If no such
error handler is defined then you'll see the Yellow Screen Of Death (YSOD) error page.
Note the error can also be handled by the umbraco.macro.Error event, where you can log/alarm with your own code and change the behaviour per event. -->
<MacroErrors>throw</MacroErrors>
<!-- These file types will not be allowed to be uploaded via the upload control for media and content -->
<disallowedUploadFiles>ashx,aspx,ascx,config,cshtml,vbhtml,asmx,air,axd,swf,xml,html,htm,svg,php,htaccess</disallowedUploadFiles>
<!-- Defines the default document type property used when adding properties in the back-office (if missing or empty, defaults to Textstring -->
<defaultDocumentTypeProperty>Textstring</defaultDocumentTypeProperty>
</content>
<security>
<!-- set to true to auto update login interval (and there by disabling the lock screen -->
<keepUserLoggedIn>false</keepUserLoggedIn>
<!-- change in 4.8: Disabled users are now showed dimmed and last in the tree. If you prefer not to display them set this to true -->
<hideDisabledUsersInBackoffice>false</hideDisabledUsersInBackoffice>
</security>
<requestHandler>
<!-- this will ensure that urls are unique when running with multiple root nodes -->
<useDomainPrefixes>false</useDomainPrefixes>
<!-- this will add a trailing slash (/) to urls when in directory url mode -->
<addTrailingSlash>true</addTrailingSlash>
</requestHandler>
<templates>
<!-- To switch the default rendering engine to MVC, change this value from WebForms to Mvc -->
<defaultRenderingEngine>Mvc</defaultRenderingEngine>
</templates>
<scheduledTasks>
<!-- add tasks that should be called with an interval (seconds) -->
<!-- <task log="true" alias="test60" interval="60" url="http://localhost/umbraco/test.aspx"/>-->
</scheduledTasks>
<!-- distributed calls must be enabled when using Umbraco in a load balanced environment -->
<distributedCall enable="false">
<!-- the id of the user who's making the calls -->
<!-- needed for security, umbraco will automatically look up correct login and passwords -->
<user>0</user>
<!--
When distributed call is enabled, you need to add all of the servers part taking in load balancing
to the server list below.
-->
<servers>
</servers>
</distributedCall>
<web.routing
trySkipIisCustomErrors="false"
internalRedirectPreservesTemplate="false" disableAlternativeTemplates="false" disableFindContentByIdPath="false"
umbracoApplicationUrl="">
</web.routing>
</settings>
I've used img tag in my cshtml file like this:
<img style="display: block;" src="#Model.Model.MainPicture" alt="#Model.Model.FirstTitle">
Sometimes if you add images in project not in usual way to include, it will not update images in build/packages, which you are submitting to IIS. Make your image in solution explorer, right click the image in solution explorer and choose properties then select "Copy always" and build project. Then publish to IIS.

Deploy ContentType with DocumentTemplate

First of all I created a few test columns...
Secondly I created a new content type (derived from Document).
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ContentType ID="0x0101000F16F9EDC2D547C48480B02B918168DD" Name="MyDocContentType1" Group="Custom Content Types" Description="My Document Content Type 1" Inherits="TRUE" Version="0">
<FieldRefs>
<FieldRef ID="{d17ecdc8-991a-4efc-a758-bbb522dd2f62}" DisplayName="My Test Column 1" Required="FALSE" Name="MyTestColumn1" />
<FieldRef ID="{8e9ef300-b566-4939-8b3c-760e13afb6d5}" DisplayName="My Test Column 2" Required="FALSE" Name="MyTestColumn2" />
</FieldRefs>
<DocumentTemplate TargetName="~site/_cts/MyDocContentType1/MyDocumentTemplate1.dotx" />
</ContentType>
</Elements>
Next I created a module deploying my word 2013 template file (.dotx) to /_cts//MyCustomTemplate1.dotx
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="DocumentTemplates" RootWebOnly="TRUE" Url="_cts/MyDocContentType1">
<File Path="DocumentTemplates\MyDocumentTemplate1.dotx" Url="MyDocumentTemplate1.dotx" Type="Ghostable" />
</Module>
</Elements>
Adding the content type to a library enables the document template...
E.g. when I create a new item of "MyDocContentType1" it opens up Word 2013.
However the document template is not correctly bound to the server - the document information panel doesn't appear and I cannot add any quick parts refering to sharepoint content type columns.
It does work when I assign the document template via the SharePoint Web UI.
Any ideas?
Edit: The word template (.dotx) is already aware of the SharePoint columns. In a previous step I assigned the DocumentTemplate manually (to design the word template). Now that the .dotx template is feature complete I want to deploy it as part of a SharePoint solution (for example to a newly created site collection).
Edit: Of course it works using a programmatic approach assigning the DocumentTemplate property via feature event receiver. That's not the solution I am looking for. Declarative only.
To me it looks like a bug. If I go to the content type, edit/update the document template (updating - not uploading a new one!) and create a new document from that content type it starts to work... ?!
I am going to assume that you created your *.dotx file directly in word and added it to Visual Studio.
The reason why it doesn't work is that the dotx file needs to have references to the SharePoint fields encoded in the Word file itself.
I would suggest to:
Deploy your content type without any document template
Add the content type to a document library
Edit the newly created list content type (inside the document library) and upload a blank empty *.dotx template: now SharePoint will create a copy of your dotx file, add all the content type columns, and save the new dotx file in the Forms/ folder in your document library ; After this, you have a blank dotx file with the correct associations - test it by adding a new document in your document library with your content type and check the information panel
Open the document library in SharePoint Manager (or with SharePoint Designer, or navigate to the Forms/ folder) and download the SharePoint-generated dotx file
Customize this dotx file to your needs
Delete the document library and retract your wsp package
add the final dotx to your solution and your content type just like you did before

How can I upload a KML file to a website for an organization with multiple locations?

I am trying to update a KML file for a website that has a multiple locations and having some trouble. I want to use it accordance with schema.org to get rich snippets in Google search results. My problem is I can't find a solid answer on how to relate multiple listings to the proper pages.
I think I understand how to create the KML file from these resources.
https://developers.google.com/kml/documentation/kml_tut
http://sixrevisions.com/web-development/5-little-known-web-files-that-can-enhance-your-website/
Here is my example code:
<?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" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
<name>Hospital 1</name>
<description>Our first hospital</description>
<Style id="pin"><IconStyle><Icon><href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href></Icon></IconStyle></Style>
<Placemark>
<LookAt>
<longitude>-0.13642</longitude>
<latitude>50.819522</latitude>
<altitude>0</altitude>
<tilt>0</tilt>
<range>5500</range>
</LookAt>
<styleUrl>#pin</styleUrl>
<Point><coordinates>-0.13642,50.819522,0</coordinates></Point>
</Placemark>
</Document>
</kml>
I know that it has to be in the root folder and named after the site. But how do I name different locations or associate them to a certain page? Can I put the kml file on the different location pages?
I might be thinking about this in the wrong way so any help would be greatly appreciated.Thank you.
From your sixrevisions.com link, the part you are missing is that you have to reference this KML file on your webpage with a LINK tag:
<link rel="alternate" type="application/vnd.google-earth.kml+xml" href="SixRevisions.kml" />
The location and name of the file aren't important (as long as you update the href attribute). You can put this tag on whatever page you want so you can point each page at a separate file.

How to create Google Earth KML network link that does not allow folder to be expanded

I have created a network link that references another KML file with actual data to be loaded into Google Earth. My issue is that the number of points in the referenced KML file is so large that it crashes Google Earth if the KML file folder underneath the Places tab in Google Earth is set to "Allow this folder to be expanded" (right-click KML, properties). By default, this checkbox is checked. I want to make it so that for every network link I create the folder by default will not be expandable.
I have looked up checkHideChildren in Google Earth KML tutorials, but that line provides no results, and I am not entirely sure where I am supposed to place the line in the Network Link KML.
Here is example code, if you could point me in the direction where to place this line of code, or an entirely different approach, it would be greatly appreciated!
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.1">
<NetworkLink>
<name>
CPU
</name>
<refreshVisibility>1</refreshVisibility>
<Link id="GPS_Plotter Updater">
<href>CPU.kml</href>
<Style id="style1"><ListStyle>
<listItemType>checkHideChildren</listItemType> <-- this is the line that should be hiding the children points of the KML!
</ListStyle>
</Style>
<styleUrl>#style1</styleUrl>
<refreshMode>onInterval</refreshMode>
<refreshInterval>1</refreshInterval>
<viewRefreshMode>onRegion</viewRefreshMode>
<viewRefreshTime>1</viewRefreshTime>
</Link>
</NetworkLink>
</kml>
Try putting the Style element in the NetworkLink, not the Link element. Link doesn't take a style selector, but NetworkLink does. If that doesn't work, try a listItemType of radioFolder instead.
In addition to Mano Marks' suggestions you also need to move the styleUrl element to the NetworkLink otherwise it won't apply. Note in your example you have viewRefreshMode=onRegion but don't have a region defined for it.
Here's the complete working example to suppress the NetworkLink contents.
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<NetworkLink>
<name>CPU</name>
<styleUrl>#style1</styleUrl>
<Style id="style1">
<ListStyle>
<listItemType>checkHideChildren</listItemType>
</ListStyle>
</Style>
<Region>
<!-- define region here -->
</Region>
<refreshVisibility>1</refreshVisibility>
<Link id="GPS_Plotter_Updater">
<href>CPU.kml</href>
<refreshMode>onInterval</refreshMode>
<refreshInterval>1</refreshInterval>
<viewRefreshMode>onRegion</viewRefreshMode>
<viewRefreshTime>1</viewRefreshTime>
</Link>
</NetworkLink>
</kml>
You can catch errors like this by validating your KML. Try using the Galdos KML Validator.

Resources