Click here to Skip to main content
11,629,371 members (64,538 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Google-Earth
Hi all,

Is it possible to search the KML generated file by google earth which contains place marks?

For example:

I need the content of the sub element (Name) for the placemark element and its coordinates.
in other way (view to me every name of the place mark and its coordinates to make it searchable by C# application using the the content of the element (name) as a keyword)

This is a sample of the KML file:



 
&lt<?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>default_myplaces_en_US.kml</name>
	<open>1</open>
	<Style id="sh_ylw-pushpin1">
		<IconStyle>
			<scale>1.3</scale>
			<Icon>
				<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
			</Icon>
			<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
		</IconStyle>
	</Style>
	<Style id="sn_ylw-pushpin">
		<IconStyle>
			<scale>1.1</scale>
			<Icon>
				<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
			</Icon>
			<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
		</IconStyle>
	</Style>
	<Style id="sn_ylw-pushpin1">
		<IconStyle>
			<scale>1.1</scale>
			<Icon>
				<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
			</Icon>
			<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
		</IconStyle>
	</Style>
	<Style id="sh_ylw-pushpin0">
		<IconStyle>
			<scale>1.3</scale>
			<Icon>
				<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
			</Icon>
			<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
		</IconStyle>
	</Style>
	<StyleMap id="msn_ylw-pushpin">
		<Pair>
			<key>normal</key>
			<styleUrl>#sn_ylw-pushpin1</styleUrl>
		</Pair>
		<Pair>
			<key>highlight</key>
			<styleUrl>#sh_ylw-pushpin</styleUrl>
		</Pair>
	</StyleMap>
	<StyleMap id="msn_ylw-pushpin0">
		<Pair>
			<key>normal</key>
			<styleUrl>#sn_ylw-pushpin</styleUrl>
		</Pair>
		<Pair>
			<key>highlight</key>
			<styleUrl>#sh_ylw-pushpin1</styleUrl>
		</Pair>
	</StyleMap>
	<StyleMap id="msn_ylw-pushpin1">
		<Pair>
			<key>normal</key>
			<styleUrl>#sn_ylw-pushpin0</styleUrl>
		</Pair>
		<Pair>
			<key>highlight</key>
			<styleUrl>#sh_ylw-pushpin0</styleUrl>
		</Pair>
	</StyleMap>
	<Style id="sn_ylw-pushpin0">
		<IconStyle>
			<scale>1.1</scale>
			<Icon>
				<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
			</Icon>
			<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
		</IconStyle>
	</Style>
	<Style id="default_myplaces_style">
		<IconStyle>
			<Icon>
			</Icon>
		</IconStyle>
	</Style>
	<Style id="sh_ylw-pushpin">
		<IconStyle>
			<scale>1.3</scale>
			<Icon>
				<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
			</Icon>
			<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
		</IconStyle>
	</Style>
	<Folder>
		<name>My Places</name>
		<open>1</open>
		<Style>
			<ListStyle>
				<listItemType>check</listItemType>
				<ItemIcon>
					<state>open</state>
					<href>C:/Program Files (x86)/Google/Google Earth/res/mysavedplaces_open.png</href>
				</ItemIcon>
				<ItemIcon>
					<state>closed</state>
					<href>C:/Program Files (x86)/Google/Google Earth/res/mysavedplaces_closed.png</href>
				</ItemIcon>
				<bgColor>00ffffff</bgColor>
				<maxSnippetLines>2</maxSnippetLines>
			</ListStyle>
		</Style>
		<Placemark>
			<name>1st Placemark</name>
			<LookAt>
				<longitude>-88.6053771201891</longitude>
				<latitude>32.28430709663048</latitude>
				<altitude>0</altitude>
				<range>250.1819494419393</range>
				<tilt>0</tilt>
				<heading>2.055254877575029</heading>
				<altitudeMode>relativeToGround</altitudeMode>
			</LookAt>
			<styleUrl>#msn_ylw-pushpin0</styleUrl>
			<Point>
				<coordinates>-88.6053771201891,32.28430709663048,0</coordinates>
			</Point>
		</Placemark>
		<Placemark>
			<name>2nd Placemark</name>
			<LookAt>
				<longitude>-88.61764632679935</longitude>
				<latitude>32.27910235483834</latitude>
				<altitude>0</altitude>
				<range>1128.948498702121</range>
				<tilt>0</tilt>
				<heading>2.048701985830222</heading>
				<altitudeMode>relativeToGround</altitudeMode>
			</LookAt>
			<styleUrl>#msn_ylw-pushpin1</styleUrl>
			<Point>
				<coordinates>-88.61764632679935,32.27910235483834,0</coordinates>
			</Point>
		</Placemark>
		<Placemark>
			<name>3rd Placemark</name>
			<LookAt>
				<longitude>-88.60302684575669</longitude>
				<latitude>32.26715342195568</latitude>
				<altitude>0</altitude>
				<range>2380.764313737851</range>
				<tilt>0</tilt>
				<heading>2.056509492270209</heading>
				<altitudeMode>relativeToGround</altitudeMode>
			</LookAt>
			<styleUrl>#msn_ylw-pushpin</styleUrl>
			<Point>
				<coordinates>-88.60302684575669,32.26715342195568,0</coordinates>
			</Point>
		</Placemark>
	</Folder>
</Document>
</kml>
 

Posted 15-Dec-12 23:10pm
M.S.S.E400
Edited 15-Dec-12 23:13pm
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

KML is XML, so you can use xpath[^]
  Permalink  
Comments
M.S.S.E at 17-Dec-12 3:35am
   
Thank you, this one helped:
http://www.codeproject.com/Articles/9494/Manipulate-XML-data-with-XPath-and-XmlDocument-C

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


Advertise | Privacy | Mobile
Web03 | 2.8.150723.1 | Last Updated 16 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100