Question

I'm working on a custom Google Map using API v3. I'm creating my KML files in Google Earth, uploading to Maps and then accessing the KML from there. I'm having problems matching polygon colours to the defaults in Maps - everything looks fine in Earth, but when viewing it on google maps, the colours have shifted.

How the KML looks on Google Earth: img31.imageshack.us/img31/2487/i1rb.jpg How the KML looks on Google Maps: img690.imageshack.us/img690/8750/xeki.jpg

You can download the KML here: https://maps.google.com/maps?q=http://abiotix.com/dontdelete/run.kml

KML file: http://abiotix.com/dontdelete/run.kml

Is anyone can help me with this issue? Thanks Asaf

Was it helpful?

Solution

The problem is the KML structure. Google Earth more flexible with the KML structure when Google Maps doesn't.

All the "Style" tags should be inside the "Document" tag and outside the "Folder" tag.

Here's a short KML example:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2">
   <Document>
      <name>orginal.kml</name>
         <Style id="1">
            <LineStyle>
               <color>ffff0000</color>
               <width>0</width>
            </LineStyle>
            <PolyStyle>
               <color>9955aaff</color>
               <fill>1</fill>
            </PolyStyle>
         </Style>
      <Folder>
         <name>pol_2013_M09_D10_0200_UTC_0200__L00_SO2_1HR_CONC</name>
         <Placemark>
            <name>17.5 - 35.0</name>
            <styleUrl>#1</styleUrl>
            <ExtendedData>
               <SchemaData schemaUrl="#pol_2013_M09_D10_0200_UTC_0200__L00_SO2_1HR_CONC">
                  <SimpleData name="index">0</SimpleData>
                  <SimpleData name="COOD">17.5</SimpleData>
                  <SimpleData name="COOD_max">35</SimpleData>
                  <SimpleData name="VALUE">17.5 - 35.0</SimpleData>
               </SchemaData>
            </ExtendedData>
            <MultiGeometry>
               <Polygon>
                  <outerBoundaryIs>
                     <LinearRing>
                        <coordinates>35.09391961043328,32.69851291029587,0 35.09384988444287,32.69862535127403,0</coordinates>
                     </LinearRing>
                  </outerBoundaryIs>
               </Polygon>
            </MultiGeometry>
         </Placemark>
         <Schema id="pol_2013_M09_D10_0200_UTC_0200__L00_SO2_1HR_CONC" name="pol_2013_M09_D10_0200_UTC_0200__L00_SO2_1HR_CONC">
            <SimpleField name="Name" type="string" />
            <SimpleField name="Description" type="string" />
            <SimpleField name="index" type="int" />
            <SimpleField name="COOD" type="float" />
            <SimpleField name="COOD_max" type="float" />
            <SimpleField name="VALUE" type="string" />
         </Schema>
      </Folder>
   </Document>
</kml>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top