Search code examples
heatmapdata-analysiskml

How to add a really tiny placemark to a KML file - to create heatmap


How can I add a really small placemark to KML file? - a tiny dot or something similar.

I have set of positions (latitude and longitude) that I can add to a KML file to create a 'heatmap'. I'm adding each position as a placemark, as I add more and positions to the file I can build up a heatmap showing cluster of positions and density.

The problem is that the icons (for example the default yellow pin) are simply too large. Is there any way to add a single dot or tiny marker? just a couple of pixels across would be fine.


Solution

  • Are you looking for something like this?:

    measle.png

    KML:

    <?xml version="1.0" encoding="UTF-8"?>
    <kml xmlns="http://earth.google.com/kml/2.1">
      <Document>
        <Style id="measle">
    <IconStyle id="measle">
      <!-- specific to IconStyle -->
      <scale>1</scale>
      <Icon>
        <href>https://maps.gstatic.com/intl/en_us/mapfiles/markers2/measle.png</href>
      </Icon>
      <hotSpot x="0.5"  y="0.5"
        xunits="fraction" yunits="fraction"/>
    </IconStyle>
        </Style>
        <Placemark id="pm123">
          <styleUrl>#measle</styleUrl>
          <name>point123</name>
          <Point>
            <coordinates>-95.44,40.42,0</coordinates>
          </Point>
        </Placemark>
        <Placemark id="pm456">
          <styleUrl>#measle</styleUrl>
          <name>point456</name>
          <Point>
            <coordinates>-95.43,40.42,0</coordinates>
          </Point>
        </Placemark>
      </Document>
    </kml>
    

    screenshot of Google Map

    example showing on a Google Maps Javascript API v3 map with KmlLayer