[R-sig-Geo] maptools/kmlPolygons not outputting all Polygon objects

Tomislav Hengl hengl at spatial-analyst.net
Sun Aug 24 13:17:09 CEST 2014


I've tried creating a KML file using the plotKML package and I did not 
notice anything strange with Alaska:

 > data(wrld_simpl)
 > library(plotKML)
plotKML version 0.4-5 (2014-07-30)
URL: http://plotkml.r-forge.r-project.org/
 > kml(wrld_simpl, colour=NAME)

You can write KML file anyway you prefer also directly by using the XML 
package (and by using the "base::sprintf" command as in 
https://r-forge.r-project.org/scm/viewvc.php/pkg/R/layer.SpatialPolygons.R?view=markup&root=plotkml).

HTH,

T. Hengl

On 4-8-2014 18:23, Philip Haines wrote:
> Dear List,
>
> I am trying to output a a SpatialPolygonsDataFrame using the maptools:::kmlPolygons function. However, I am only able to get this function to output the first Polygon from each Polygons object.
>
> If I try the example given in the documentation
>
> library(maptools)
> data(wrld_simpl)
> kmlPolygons(wrld_simpl, kmlfile = "worldPolitical.kml", name = "KML Polygons",
>             description = "the world", col = "red",
>             visibility = 1, lwd = 1, border = "white", kmlname = "R Test",
>             kmldescription = "This is <b>only</b> a <a
> href='http://www.r-project.org'>R</a> test.")
>
> I notice that it contains an outline for the lower 48 states but does not contain an outline for Alaska (say).
>
> If this is not the correct place to post this query I would be grateful if you would both accept my apologies and point me in a more favourable direction. The world of spatial data objects remains a very new one to me!
>
> Thanks,
> Phil Haines
>
> Below is my output from the sessionInfo() command.
>
>> sessionInfo()
> R version 3.1.0 (2014-04-10)
> Platform: x86_64-w64-mingw32/x64 (64-bit)
>
> locale:
> [1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252
> [3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
> [5] LC_TIME=English_United Kingdom.1252
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] maptools_0.8-30 sp_1.0-15
>
> loaded via a namespace (and not attached):
> [1] foreign_0.8-61  grid_3.1.0      lattice_0.20-29 tools_3.1.0
>
>
>
> This message and any attachments contain information that may be RMS Inc. confidential and/or privileged.  If you are not the intended recipient (or authorized to receive for the intended recipient), and have received this message in error, any use, disclosure or distribution is strictly prohibited.   If you have received this message in error, please notify the sender immediately by replying to the e-mail and permanently deleting the message from your computer and/or storage system.
>
>
> 	[[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
>



More information about the R-sig-Geo mailing list