2

I have generated a KML file (see below). My question is: how do I add definitions etc. in the file in order to remove the icons? I only want to display the name, for example A, B etc. I know this can be done in Google Earth but my use case is to generate the file with a program.

<?xml version='1.0' encoding='UTF-8'?>
<kml xmlns='http://www.opengis.net/kml/2.2'>
 <Document>
  <open>1</open>
  <name>text</name>
  <Folder>
   <name>Grid</name>
   <Placemark>
    <name>A</name>
    <Point>
     <coordinates>17.78290100000001,59.51952679585495</coordinates>
    </Point>
   </Placemark>
   <Placemark>
    <name>B</name>
    <Point>
     <coordinates>17.78334264203328,59.51952679510959</coordinates>
    </Point>
   </Placemark>
   <Placemark>
    <name>C</name>
    <Point>
     <coordinates>17.783784284066495,59.519526792873464</coordinates>
    </Point>
   </Placemark>
   <Placemark>
    <name>D</name>
    <Point>
     <coordinates>17.78422592609964,59.51952678914665</coordinates>
    </Point>
   </Placemark>
   <Placemark>
    <name>E</name>
    <Point>
     <coordinates>17.78466756813268,59.51952678392921</coordinates>
    </Point>
   </Placemark>
   <Placemark>
    <name>F</name>
    <Point>
     <coordinates>17.785109210165544,59.51952677722101</coordinates>
    </Point>
   </Placemark>
   <Placemark>
    <name>G</name>
    <Point>
     <coordinates>17.785550852198252,59.519526769022065</coordinates>
    </Point>
   </Placemark>
   <Placemark>
    <name>H</name>
    <Point>
     <coordinates>17.785992494230708,59.51952675933237</coordinates>
    </Point>
   </Placemark>
   <Placemark>
    <name>I</name>
    <Point>
     <coordinates>17.78643413626291,59.51952674815204</coordinates>
    </Point>
   </Placemark>
   <Placemark>
    <name>J</name>
    <Point>
     <coordinates>17.78687577829478,59.51952673548094</coordinates>
    </Point>
   </Placemark>
   <Placemark>
    <name>1</name>
    <Point>
     <coordinates>17.782680178983348,59.51963899981365</coordinates>
    </Point>
   </Placemark>
   <Placemark>
    <name>2</name>
    <Point>
     <coordinates>17.78268017751645,59.519863408097926</coordinates>
    </Point>
   </Placemark>
   <Placemark>
    <name>3</name>
    <Point>
     <coordinates>17.782680176049567,59.5200878163745</coordinates>
    </Point>
   </Placemark>
   <Placemark>
    <name>4</name>
    <Point>
     <coordinates>17.78268017458258,59.52031222464326</coordinates>
    </Point>
   </Placemark>
   <Placemark>
    <name>5</name>
    <Point>
     <coordinates>17.782680173115605,59.52053663290431</coordinates>
    </Point>
   </Placemark>
   <Placemark>
    <name>6</name>
    <Point>
     <coordinates>17.78268017164867,59.52076104115758</coordinates>
    </Point>
   </Placemark>
   <Placemark>
    <name>7</name>
    <Point>
     <coordinates>17.782680170181635,59.5209854494031</coordinates>
    </Point>
   </Placemark>
   <Placemark>
    <name>8</name>
    <Point>
     <coordinates>17.782680168714595,59.521209857640876</coordinates>
    </Point>
   </Placemark>
  </Folder>
 </Document>
</kml>

Grid labels

1 Answer 1

2

You'll need to add Style tags, containing an IconStyle tag, and then set the icon scale to zero. This can be done either by putting a Style within each placemark, OR by defining one shared style at the top of the file, and then referencing it with a simple styleUrl tag in each placemark.

Here is a very basic example of what the style tag could look like:

<Style>
    <IconStyle>
        <scale>0</scale>
    </IconStyle>
</Style>

For more background on KML styles, including how to use shared styles, see the "Styles for Geometry" section of the KML tutorial: https://developers.google.com/kml/documentation/kml_tut#geometrystyles

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.