Programmatically creating vector arrows in KML

Does anyone have practical examples of programmatically drawing icons as vectors in KML? In particular, I have data with magnitude and azimuth at given coordinates, and I would like icons (or another graphic element) to be created based on these values.

Some thoughts on how I can approach him:

  • Image catalog (brute force method): create an image manager from 360 different image files (possibly batch rotation of one image), each of which indicates an azimuth. I have seen things like Excel in KML , but I am looking for code that I can use in a program and not in a web utility. Problem : The arrow does not contain a magnitude context, so it should be a label. I would rather dynamically lengthen the arrow.

  • Creating a string in KML . Perhaps create a formula that creates a line with the origin at coordinate points, with a line length proportional to the value, and inclined in azimuth, Then there will be two more lines, maybe 30 degrees or so, starting from the end of the previous line to make an arrow . Problems : not a separate image icon, so I'm not sure how it will work in KML. Also not sure how easy it would be to generate this algorithm.

  • Separate generation of images: Perhaps create a PHP file that uses imagemagick or something similar to dynamically creating a .png file in the same way above, and then link to the icon using the URI "domain.tld / imagegen.php? Value = magvalue & aimim = azmvalue ". Problem : There is still a problem writing an image generation algorithm.

So the question is : has anyone else come up with solutions for generating vector software (and not just arrows)?

+5
source share
1 answer

( Fortran!) 1, KML IconStyle.

, , , ( , 0 360 ), - ( ). . KML, , "my-vector-1" 1,8 90,0 ( ):

<IconStyle id="my-vector-1">
    <scale>1.8</scale>
    <heading>90.0</heading>
    <Icon>
        <href>/path/to/arrow.png</href>
    </Icon> 
</IconStyle>

IconStyle:

<Placemark>
  <styleUrl>#my-vector-1</styleUrl>
  <Point>
     <coordinates>-10.5,10.8</coordinates>
  </Point>

:

<kml><Document> ... </Document></kml> 

. ( ), , . , , , Fortran, ...

+3

All Articles