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

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
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.

Are you looking for something like this?:
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>
example showing on a Google Maps Javascript API v3 map with KmlLayer

Related

How can I set the label color for all markers in a layer in Google Maps?

I have seen a few related questions but none answered my question completely.
This mentions Javascript: How to override KML colors in Google Map?
This mentions the KML color code helper but doesn't give a solution for applying it: Google Maps KML: 8-Digit Hex Code
The KML reference suggests using a <Style> but that didn't work: https://developers.google.com/kml/documentation/kmlreference#balloonstyle
Is there any way to set the color (or style, generally) for all markers of a given layer, so as to distinguish it from other layers?
This isn't perfect -- I'd rather there was an easy point-and-click way to do this in the UI -- but here goes.
Let's use a layer of markers for US National Parks as an example; taken from Wikipedia here: https://tools.wmflabs.org/kmlexport?article=List_of_national_parks_of_the_United_States
I've added these to a new map with the Import tool
I think the easiest way to do this is to apply all of the desired styling to a single marker within the UI, say the first one. For simplicity I just made it orange:
Now, export the layer to KML & open the KML file. Here's the condensed version of that file:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>National parks</name>
<Style id="icon-1899-0288D1-normal">
<IconStyle>
<color>ffd18802</color>
<!-- more attributes -->
</IconStyle>
<LabelStyle>
<scale>0</scale>
</LabelStyle>
</Style>
<Style id="icon-1899-0288D1-highlight">
<!-- similar markup -->
</Style>
<StyleMap id="icon-1899-0288D1">
<Pair>
<key>normal</key>
<styleUrl>#icon-1899-0288D1-normal</styleUrl>
</Pair>
<Pair>
<key>highlight</key>
<styleUrl>#icon-1899-0288D1-highlight</styleUrl>
</Pair>
</StyleMap>
<!-- Two more <Style> tags for -normal and -highlight -->
<Style id="icon-1899-F57C00-normal"></Style>
<Style id="icon-1899-F57C00-highlight"></Style>
<!-- Another <StyleMap> -->
<StyleMap id="icon-1899-F57C00"></StyleMap>
<Placemark>
<name>Acadia</name>
<description>...</description>
<styleUrl>#icon-1899-F57C00</styleUrl>
<Point>...</Point>
</Placemark>
<Placemark>
<name>National Park of American Samoa</name>
<description>...</description>
<styleUrl>#icon-1899-0288D1</styleUrl>
<Point></Point>
</Placemark>
<!-- More <Placemark>s for the other parks -->
</Document>
</kml>
From here, we simply need to replace the reference style in the <styleUrl> of all of the labels with that used by Acadia. This is a simple find-and-replace-all. We can also remove the obsolete <Style>s and <StyleMap> but this is not strictly necessary. After that, save the updated KML and re-import it to Google Maps and we're done:

display label next to icon in Google Maps KML

I am using KML with the Google Maps API. The KML is used to display Mile Markers on interstates (see screenshot):
A snippet of the KML:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Style id="randomLabelColor">
<LabelStyle>
<color>ff0000cc</color>
<colorMode>random</colorMode>
<scale>1.5</scale>
</LabelStyle>
</Style>
<Placemark>
<name>17</name>
<styleUrl>#randomLabelColor</styleUrl>
<description>I-684 MM NORTHBOUND: 17</description>
<Style>
<IconStyle>
<Icon>
<href>http://www.xxxx.com/images/mapicons/milemarker.png</href>
</Icon>
</IconStyle>
</Style>
<Point>
<coordinates>-73.67661,41.25393</coordinates>
</Point>
</Placemark>
</Document>
</kml>
I realize clicking the Mile Marker icon will display a callout with the name and description. But is it possible to have a label drawn on the map next to the icon? I would like to put the numeric mile marker on the map (e.g. 17)
Or instead of KML do I need to use javascript and create markers?
I've been looking for an answer to the same question. Going over the Google Maps API "KML and GeoRSS Layers" guide I noticed that the <LabelStyle> element is not supported.

kml polygon filling/border distortion when zoomed in

I display KML polygons in Google maps.
When zooming in near the border of the polygon, the polygon border and fill becomes distorted and/or disappears.
(areas inside the polygon are not filled, and areas outside are filled).
Zooming back out resolves the issue.
Issue can be reproduced by copying and pasting the kml below into
http://display-kml.appspot.com/, then zooming in on the Western border of the box. (zoom in 4 clicks before I see the shading flip inside/outside).
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Folder>
<name>District</name>
<open>1</open>
<Placemark>
<MultiGeometry>
<Polygon>
<outerBoundaryIs><LinearRing><coordinates>
-92.02,38.53
-92.02,38.52
-92.45,38.52
-92.45,38.53
-92.02,38.53
</coordinates></LinearRing></outerBoundaryIs></Polygon>
</MultiGeometry>
</Placemark>
</Folder>
</Document>
</kml>
Images Here:
http://itic.occinc.com/good.png
(and bad.png) Stackoverflow would not let me post 3 links.
I believe this has been fixed. Thanks for the report!

How to customize the tool tip of GOOGLE MAP (KML) with JAK API

I have a problem with the tool tip in google map.
As you can to see, I have one polygon in my map. But when I click on this polygon as you see in the kml display, the display of the tooltip is cut (Click on the zone map).
To realized this map, I used a KML file, the KML is generated with JAK API.
I think it should be possible to modify the css of the tool tip with the api but I don't know how. I already searched a couple of hours.
I m not an expert with this API and Google Map. So If you have any advice to resovle this problem don't hesitate. I'm going to continue to search.
Thank you so much in advance for your help.
You'll find below a set of image that explains the problem :
URL To test a KML File :
http://display-kml.appspot.com/
Content of the KML File :
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:xal="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0">
<Document>
<name>IBR</name>
<Style>
<PolyStyle id="toolTip">
<color>0xb9cbf1</color>
<colorMode>normal</colorMode>
<fill>1</fill>
<outline>1</outline>
</PolyStyle>
</Style>
<Style>
<LineStyle id="lineStyle">
<color>0x666ef8</color>
<width>1.0</width>
</LineStyle>
</Style>
<Placemark>
<name>Edmonton Yp</name>
<styleUrl>#toolTip</styleUrl>
<Polygon>
<extrude>1</extrude>
<altitudeMode>relativeToGround</altitudeMode>
<outerBoundaryIs>
<LinearRing>
<coordinates>-113.99345397949219,53.65755844116211 -113.98419189453125,53.59413146972656 -113.93543243408203,53.42497253417969 -113.68433380126953,53.25069046020508 -113.68347930908203,53.250675201416016 -113.67694091796875,53.250667572021484 -113.39179992675781,53.25058364868164 -113.3207778930664,53.25060272216797 -112.96499633789062,53.39612579345703 -112.87796020507812,53.45442199707031 -112.80402374267578,53.51348114013672 -112.80384826660156,53.54147720336914 -112.80400848388672,53.57035827636719 -112.95169067382812,53.65762710571289 -113.29582214355469,53.71658706665039 -113.56759643554688,53.720455169677734 -113.93214416503906,53.71586608886719 -113.93550872802734,53.715370178222656 -113.99345397949219,53.65755844116211</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
</Document>
</kml>

Hiding placemarks in KML used to center and zoom a map

I have a embedded map on my site in which I display various location based on the user's search results. In some cases we do not have location data and instead display a screen overlay indicating this. I additionally set a couple of placemarks to force the map to zoom and center on a specific region (the default if there is no location data being the full zoom out, which is kind of ugly).
My problem is I want to hide these placemarks, as otherwise they appear to indicate there are locations available and none of the following has worked:
the visibility flag on elements seems to only be supported in google earth
a custom transparent png specified as the Placemark Icon href does not load, and I get the default blue pin.
I tried creating a region on the folder which encompasses the placemarks and setting a LOD which should disable it, but this appears to not do anything at all (KML below).
I believe I am missing a simple way to accomplish this, but a nudge would be helpful. Here is the KML using regions:
<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<ScreenOverlay>
<Icon>
<href>URL/mapDisclaimer.png</href>
</Icon>
<overlayXY x="0.5" xunits="fraction" y="0.5" yunits="fraction" />
<screenXY x="0.5" xunits="fraction" y="0.5" yunits="fraction" />
<size x="0" xunits="pixels" y="0" yunits="pixels" />
</ScreenOverlay>
<Folder>
<name>PlaceHolderFolder</name>
<Style id="placeholderStyle">
<IconStyle>
<Icon>
<href>URL/transparentBlock.png</href>
</Icon>
</IconStyle>
</Style>
<Region>
<LatLonAltBox>
<north>79</north>
<south>59</south>
<east>-102</east>
<west>-137</west>
</LatLonAltBox>
<Lod>
<maxLodPixels>20</maxLodPixels>
</Lod>
</Region>
<Placemark>
<styleUrl>#placeholderStyle</styleUrl>
<Point>
<coordinates>-136.582031,69.16256</coordinates>
</Point>
</Placemark>
<Placemark>
<styleUrl>#placeholderStyle</styleUrl>
<Point>
<coordinates>-110.566406,78.560486</coordinates>
</Point>
</Placemark>
<Placemark>
<styleUrl>#placeholderStyle</styleUrl>
<Point>
<coordinates>-102.128906,59.977005</coordinates>
</Point>
</Placemark>
</Folder>
</Document>
</kml>
The transparent PNG should work, but you must move the <Style/>-element out of <Folder/> and make it a child of <Document/>