I have 8000 polygons that I need to show on Google maps (certain US Zip/Postal codes -- not all of them). I have a "root" KML file that contains 10 network links that divide these zip codes up by region. In those region network links, I have more network links that divide these up by state with an average of about ~300 polygons per file. Below is an example of my KML files (shortened for example):
Root.kml:
<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>regions</name>
<NetworkLink>
<Link>
<href>https://url/region0.kml</href>
<viewRefreshMode>onRegion</viewRefreshMode>
</Link>
</NetworkLink>
<NetworkLink>
<Link>
<href>https://url/region1.kml</href>
<viewRefreshMode>onRegion</viewRefreshMode>
</Link>
</NetworkLink>
<!-- additional Network Link regions -->
</Document>
</kml>
region0.kml:
?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>region0</name>
<NetworkLink>
<Region>
<LatLonAltBox>
<north>36.244860000000003</north>
<south>31.542739999999998</south>
<east>-109.49429000000001</east>
<west>-114.66689</west>
</LatLonAltBox>
<Lod>
<minLodPixels>128</minLodPixels>
<maxLodPixels>1024</maxLodPixels>
<minFadeExtent>128</minFadeExtent>
<maxFadeExtent>512</maxFadeExtent>
</Lod>
</Region>
<Link>
<href>https://url/US-AZ.kml</href>
<viewRefreshMode>onRegion</viewRefreshMode>
</Link>
</NetworkLink>
<!-- additional State KMLs for this region -->
</Document>
</kml>
US-AZ.kml:
<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>US-AZ</name>
<Region>
<LatLonAltBox>
<north>36.244860000000003</north>
<south>31.542739999999998</south>
<east>-109.49429000000001</east>
<west>-114.66689</west>
</LatLonAltBox>
<Lod>
<minLodPixels>128</minLodPixels>
<maxLodPixels>1024</maxLodPixels>
<minFadeExtent>128</minFadeExtent>
<maxFadeExtent>512</maxFadeExtent>
</Lod>
</Region>
<Placemark>
<name>85208</name>
<Polygon>
<outerBoundaryIs>
<LinearRing>
<coordinates>-111.68398999999999,33.393230000000003
-111.58019,33.393160000000002
-111.58078999999999,33.404260000000001
-111.58089,33.404260000000001
-111.58078999999999,33.407719999999998
-111.59789000000001,33.407760000000003
-111.59799,33.411209999999997
-111.58909,33.411250000000003
-111.58929000000001,33.414940000000001
...
</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
<!-- additional Placemarks -->
</Document>
</kml>
It seems to work fine for the first region and the first state in that region (this example is US-AZ Arizona), but ignores all other regions and states. So about ~1000 polygons get rendered, but none of the other 8000 polygons get rendered.
When loading the KML in Google Earth, each of the state KML files work fine individually.
I followed the Google Keyhole examples for NetworkLink and Regions, but it doesn't seem to matter what I do that any of the other regions and network links will render.
Any ideas or a better way to show 8000 polygons using Google maps that I might be missing (and doesn't take a very long time to display on the map)?
Thanks to #Christiann Adams and #geocodezip to setting me straight.
For anyone else that is having this issue, you can only have 10 network links TOTAL through all files (as mentioned in the comments above).
How I got around it was having multiple KML layers, with no more than 10 network links per file. This seems to work for me.
Hope it helps someone else.
Related
I'd like upload the KML file which including the PNG file on the Google Map.
The process was done normally. But I could not see the PNG data on the Google map.
Related files are as follows;
1) KML source file with text format;
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<GroundOverlay><name>ER001_Polda Balicpapan.png</name><color>88ffffff</color><Icon>
<href>ER001_Polda Balicpapan.png</href>
<viewBoundScale>0.75</viewBoundScale></Icon><LatLonBox>
<north>-.690568</north>
<south>-1.770432</south>
<east> 117.8462</east>
<west> 115.925</west>
</LatLonBox></GroundOverlay></kml>`
2) Message on the Google map
It can not display a row of data(ER001.PNG)
Please let me know that how can I display this Ground Overlay on the Google Map?
See the example in the documentation
Put the image somewhere publicly available and use the fully qualified URL.
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Folder>
<name>Ground Overlays</name>
<description>Examples of ground overlays</description>
<GroundOverlay>
<name>Large-scale overlay on terrain</name>
<description>Overlay shows Mount Etna erupting
on July 13th, 2001.</description>
<Icon>
<href>https://developers.google.com/kml/documentation/images/etna.jpg</href>
</Icon>
<LatLonBox>
<north>37.91904192681665</north>
<south>37.46543388598137</south>
<east>15.35832653742206</east>
<west>14.60128369746704</west>
<rotation>-0.1556640799496235</rotation>
</LatLonBox>
</GroundOverlay>
</Folder>
</kml>
another option would be to create a KMZ file that includes the image in the correct relative path.
I have kml google map which does not auto refresh. Does anybody have an idea how to do it?
My kml code:
<kml xmlns="http://earth.google.com/kml/2.0">
<Document>
<visiblity>1</visiblity>
<NetworkLink>
<name>USGS WaterWatch</name>
<flyToView>1</flyToView>
<Url>
<href><![CDATA[http://waterwatch.usgs.gov/?m=real&w=kml®ions=co]]></href>
<refreshMode>onInterval</refreshMode>
<refreshInterval>3600</refreshInterval>
<viewRefreshMode>never</viewRefreshMode>
<viewRefreshTime>1800</viewRefreshTime>
</Url>
<refreshVisibility>1</refreshVisibility>
</NetworkLink>
</Document>
</kml>
Some KML elements are not supported in Google Maps.
For example, the <refreshVisibility> element is not supported.
List of limitations of KML in Maps can be found here:
https://developers.google.com/kml/documentation/kmlelementsinmaps
There are also some validation errors in your KML. The spelling and order of elements in KML is strict. The visiblity element must be renamed to visibility and order of elements in NetworkLink must be reordered: flyToView, refreshVisibility, Url. The namespace used is the older one and the Url element is deprecated. Suggest you update the KML to the following:
<kml xmlns="http://www.opengis.net/kml/2.2">
<NetworkLink>
<name>USGS WaterWatch</name>
<refreshVisibility>1</refreshVisibility>
<flyToView>1</flyToView>
<Link>
<href><![CDATA[http://waterwatch.usgs.gov/?m=real&w=kml®ions=co]]></href>
<refreshMode>onInterval</refreshMode>
<refreshInterval>3600</refreshInterval>
<viewRefreshMode>never</viewRefreshMode>
<viewRefreshTime>1800</viewRefreshTime>
</Link>
</NetworkLink>
</kml>
I have a KML file with 74 points and some info on the description field. These points represent some stores around my city. Im working on Google Maps engine and I uploaded the file, it was processed and it displays on the base map perfectly. The problem comes when I try to find an specific store using the search box in the Maps engine interface. It does not show any of the stores uploaded in the KML file. Same thing when I try to see it on the Maps engine app for android, the points are displayed on the map, i can see the description info on each point, but when I want to find one in particular using the serch box, it does not show any of the points as a result.
This is the KML code of one of the points (store)
<?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>KmlFile</name>
<Style id="icon-503-009D57">
<IconStyle>
<color>ff579d00</color>
<scale>1.1</scale>
<Icon>
<href>http://www.gstatic.com/mapspro/images/stock/503-wht-blank_maps.png</href>
</Icon>
</IconStyle>
</Style>
<Placemark>
<name>Disensa Sixto Robayo</name>
<description>Latitud: -2.276092
Longitud: -79.894329
Direccion: Av. Cacique Tomalá Mz 63 Solar 12
Telefono: 042486407
Contacto: Sixto Robayo Niza
Ciudad: Guayaquil</description>
<styleUrl>#icon-503-009D57</styleUrl>
<ExtendedData>
<Data name="string">
<displayName>Ciudad</displayName>
<value>Guayaquil</value>
</Data>
</ExtendedData>
<Point>
<coordinates>-79.894329,-2.276092,0</coordinates>
</Point>
</Placemark>
</Document>
</kml>
The following simple example illustrates a problem I am having with ALL my KML files:
Link to Simple KML Example
Here is the code:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.0">
<Document>
<name>KML Example file</name>
<description>Simple markers</description>
<Placemark>
<name>Marker 1</name>
<description>Some stuff to put in the first info window</description>
<Point>
<coordinates>-122.1,37.4,0</coordinates>
</Point>
</Placemark>
</Document>
</kml>
It loads into Google Maps just fine. The one Placemarker Icon appears in the right location, but when I click on marker 1 in the left panel, Google Maps moves to the Atlantic Ocean just south of Ghana.
I have tried various simple and complex KML files and they all to this. If I use the My Places upload function on the same files this particular behaviour does not happen.
I am using Chrome 21 and Windows 7.
Thanks anyone!
#Mike, you are using what appears to be an older namespace:
<kml xmlns="http://earth.google.com/kml/2.0">
Perhaps you'll have better luck by instead using the definitive namespace for KML 2.2:
<kml xmlns="http://www.opengis.net/kml/2.2">
I also strongly encourage you to make use of this reputable KML Validator.
I am trying to change the style of a marker from a KML file in googlemaps. When I run the file in googleearth, the marker is different. When I run it in googlemaps it's just the same looking marker as before. Why is that happening?
Here's the beginning of the kml file:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.google.com/earth/kml/1">
<Document>
<Style id="bendigo">
<BalloonStyle>
<text>$[description]</text>
</BalloonStyle>
<IconStyle>
<Icon>
<href>http://maps.google.com/mapfiles/kml/paddle/grn-blank.png</href>
</Icon>
</IconStyle>
</Style>
<name>kml_sample1.kml</name>
<Placemark>
<name>Boat</name>
<description><![CDATA[
Boat<br />
<p>Home page: google.com</p>
]]>
</description>
<styleUrl>#bendigo</styleUrl>
<Point>
<!--run a javascript to get data points-->
<coordinates>7.666037,64.32565</coordinates>
</Point>
Your KML snippet above is missing ending tags for Placemark, Document, and kml.
Once fixed I was able to load the KML into Google Maps and it looks fine (green marker).
There was a recent update to the KML is rendered in Google Maps which may have temporarily affected this, but I am unable to be sure since it works fine for me now. If you confirm it now looks fine to you, that was probably the issue.