[R-sig-Geo] plotKML - set color according to category
Almut Schlaich - Werkgroep Grauwe Kiekendief
almut.schlaich at grauwekiekendief.nl
Tue Aug 4 10:36:42 CEST 2015
Dear Adam,
Thank you for your response!
I run your script on the raster data and I think the requirements are
the same. For my point data set I already have a colomn with a factorial
variable (in this case the phases of the annual cylce) and the points
are colored according to them.
But imagine you would make maps of your raster data of two different
countries, where the second one has different categories from the other
(e.g. the second country could have values [13,14],
(14,15],(15,16],(16,17] instead of [14,15],(15,16],(16,17],(17,18) for
the Philippines). Then the plotKML would use the same four colors for
these two maps, even though the values are not the same.
Could you now also define that e.g. [13,14] is white, (14,15) light
yellow and so on and use the same color for the same value in the
different plots?
Thanks again and kind regards,
Almut
Am 8/4/2015 um 7:09 AM schrieb Adam Sparks:
> Dear Almut,
> I've done this with raster data, but not points as you are describing.
> If you convert to a factor and then cut the data, it is possible to
> create a KML as you are describing. Towards the end of a script that I
> put together for the Manila R User Group there's some code that may help.
>
> https://github.com/adamhsparks/Philippine_R_User_Group/tree/master
>
>
>
> On Wed, Jul 29, 2015 at 11:12 PM, Almut Schlaich - Werkgroep Grauwe
> Kiekendief <almut.schlaich at grauwekiekendief.nl
> <mailto:almut.schlaich at grauwekiekendief.nl>> wrote:
>
> Dear Dr. Hengl,
>
> First of all, I would like to thank you and your colleagues for
> the great package plotKML that I really enjoy using.
> This was indeed a missing link to visualize data, in our case
> tracking data, in Google Earth to easily explore them visually.
>
> I would like to ask you a question about the possibilities to
> color the points according to a variable.
> In my data table I have a column with classification category
> "phase" (e.g. migration, stopover, breeding, wintering etc.).
> Using e.g.:
> kml_layer(data,colour=phase,colour_scale=worldgrids_pal[[4]]), I
> get tracks nicely colored depending on category.
>
> But the difficulty arises when one bird has less levels of the
> category than another (e.g. one bird making no stopover).
> In this case the same colors are used, but for different values of
> the category, just in the order of first appearance.
> To easily compare tracks between individuals I would like to color
> the same category always in the same color. I tried to
> define the colors for each category and give the column with a
> color value per point to the kml_layer function, but this
> didn't work. Is it possible to determine the color of each point?
>
> At the moment I just use the combination of kml_open, kml_layer
> and kml_close to produce the output.
> Unfortuntely, the much more beautiful and handy plotKML for
> Space-time Trajectory Data Frames doesn't work for the
> tracks since they have too many points. Could you tell me what is
> the limit for this? And might it be possible for more
> points in near future?
>
> Thank you in advance for your help!
>
> Kind regards,
> Almut Schlaich
>
> --
> Almut Schlaich
>
> Werkgroep Grauwe Kiekendief
> telefoon: +31(0)650459766
> e-mail: almut.schlaich at grauwekiekendief.nl
> <mailto:almut.schlaich at grauwekiekendief.nl>
> postadres: Postbus 46, 9679 ZG Scheemda
> www.grauwekiekendief.nl <http://www.grauwekiekendief.nl>
> twitter: @grauwekiek
> facebook:
> www.facebook.com/pages/Werkgroep-Grauwe-Kiekendief/190585087622000
> <http://www.facebook.com/pages/Werkgroep-Grauwe-Kiekendief/190585087622000>
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org <mailto:R-sig-Geo at r-project.org>
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>
>
>
> --
> --
> Adam Sparks
> Plant Disease Management Specialist
> IRRI
> DAPO Box 7777, Metro Manila, Philippines
> ph: +63(2) 580-5600 ext 2753
>
> @adamhsparks <https://twitter.com/adamhsparks>
--
Almut Schlaich
Werkgroep Grauwe Kiekendief
telefoon: +31(0)650459766
e-mail: almut.schlaich at grauwekiekendief.nl
postadres: Postbus 46, 9679 ZG Scheemda
www.grauwekiekendief.nl
twitter: @grauwekiek
facebook: www.facebook.com/pages/Werkgroep-Grauwe-Kiekendief/190585087622000
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list