[R-sig-Geo] plotKML kml_layer.Raster problem

Tomislav Hengl hengl at spatial-analyst.net
Fri Nov 7 09:56:28 CET 2014


I would assume that the value column in the Raster object is somehow 
converted to "character" class.

If you could provide access to your data and code we can do a better job 
(it could be that there is also a bug in plotKML i.e. completely not 
your fault).

HTH,

T. Hengl


On 7-11-2014 7:52, Frede Aakmann Tøgersen wrote:
> Hi Andreas
>
> Can you provide a small example showing the details of what you're trying to do. I don't think that anyone can help you with the little information you have given.
>
> If you do not have any example please show us the output from traceback() immediately after the error.
>
> I don't think this has anything to do with NA's in your data values as I don't get any errors doing this (from man of kml_layer.Raster):
>
>
> data(eberg_grid)
> library(sp)
> coordinates(eberg_grid) <- ~x+y
> gridded(eberg_grid) <- TRUE
> proj4string(eberg_grid) <- CRS("+init=epsg:31467")
> data(SAGA_pal)
> library(raster)
> r <- raster(eberg_grid["TWISRT6"])
>
> ## Put some NA's into data
> r at data@values[1:10] <- NA
>
> kml(r, colour_scale = SAGA_pal[[1]], colour = TWISRT6)
>
>
>
>
> Yours sincerely / Med venlig hilsen
>
>
> Frede Aakmann Tøgersen
> Specialist, M.Sc., Ph.D.
> Plant Performance & Modeling
>
> Technology & Service Solutions
> T +45 9730 5135
> M +45 2547 6050
> frtog at vestas.com
> http://www.vestas.com
>
> Company reg. name: Vestas Wind Systems A/S
> This e-mail is subject to our e-mail disclaimer statement.
> Please refer to www.vestas.com/legal/notice
> If you have received this e-mail in error please contact the sender.
>
>
>> -----Original Message-----
>> From: r-sig-geo-bounces at r-project.org [mailto:r-sig-geo-bounces at r-
>> project.org] On Behalf Of Andreas Gros
>> Sent: 6. november 2014 23:47
>> To: r-sig-geo at r-project.org
>> Subject: [R-sig-Geo] plotKML kml_layer.Raster problem
>>
>> In version 0.4-6 of plotKML, when I'm adding a kml_layer.Raster (single
>> layer, no stack/brick) to a kml file, I get the following error message:
>>
>> Error in setValues(x, value) :
>> values must be numeric, integer, logical or factor
>>
>>
>> The values in the raster range between -57 and 2000 and it also occurs if I
>> replace NA values first with some arbitrary numerical value.
>> Has anyone come across this problem and knows how to fix/circumnavigate
>> it?
>>
>> Thanks!
>>
>> 	[[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



More information about the R-sig-Geo mailing list