[OpenLayers-Users] Follow the arrows
Paul Vint
pjvint at gmail.com
Wed Jan 25 02:40:48 EST 2012
Hi Shadin,
Interesting timing - I just finally got on this list, and this is the first
message I received, and I just was working on just that in my project.....
Here's what I've done:
In my PHP code I'm creating a KML file that I'll be loading, and I do the
following:
## Divide the bearing by 22 to get a value
from 0-15 for icons
$p->setStyleUrl('#track-' .
round($this->bearing[$c] / 22));
This sets the style in my KML to reference "track-4.png" (or any other
number from 0-15)
In my style declarations in the KML I have:
<Style id="track-0">
<IconStyle>
<hotSpot x="19" y="0" xunits="pixels" yunits="pixels" />
<color>8800aa00</color>
<colorMode>normal</colorMode>
<scale>1</scale>
<Icon>
<href>img/KMLIcons/track-0.png</href>
</Icon>
</IconStyle>
</Style>
<Style id="track-1">
<IconStyle>
<hotSpot x="19" y="0" xunits="pixels" yunits="pixels" />
<color>8800aa00</color>
<colorMode>normal</colorMode>
<scale>1</scale>
<Icon>
<href>img/KMLIcons/track-1.png</href>
</Icon>
</IconStyle>
</Style>
Also there is "track-none.png" for a non-directional marker.
I just remembered that the hotspot is wrong there - change it so x and y
are 0.5, and use "fraction" for the units to have it align over the centre
of the location.
If you want the icons, there's a zip file with them at
http://vint.ca/dumps/directionalKMLIcons.zip
Cheers
Paul
On Wed, Jan 25, 2012 at 2:13 AM, Marc Jansen <jansen at terrestris.de> wrote:
> **
> Hi Shadin,
>
> Have a look at
> http://openlayers-buch.de/beispiele/chapter-10/layer-lineDirection.html(which is working on an older version of OpenLayers), which might be of
> help. This is the source code:
> http://openlayers-buch.de/beispiele/chapter-10/OpenLayers.Layer.LineDirections.js
> .
>
> Best regards,
> Marc
>
>
> On 21.01.2012 15:41, Shadin wrote:
>
> * I am wondering about how to replace my features with arrows depending
> on its direction in the DB. the direction shown as numbers from 0 - 360 I
> have found this but still not sure has anyone ever tried something similar
> ? * http://blog.geoserver.org/2009/04/02/follow-the-arrows/
> ------------------------------
> View this message in context: Follow the arrows<http://osgeo-org.1803224.n2.nabble.com/Follow-the-arrows-tp7211128p7211128.html>
> Sent from the OpenLayers Users mailing list archive<http://osgeo-org.1803224.n2.nabble.com/OpenLayers-Users-f1822463.html>at Nabble.com.
>
>
> _______________________________________________
> Users mailing listUsers at lists.osgeo.orghttp://lists.osgeo.org/mailman/listinfo/openlayers-users
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120125/997dc8e6/attachment-0001.html
More information about the Users
mailing list