SCM

[#5938] Bug for STIDF with SpatialPolgons

Date:
2014-09-22 20:18
Priority:
3
State:
Open
Submitted by:
Dave T (davidt0x)
Assigned to:
Nobody (None)
Component:
None
Version:
None
Resolution:
None
Summary:
Bug for STIDF with SpatialPolgons

Detailed description
Not sure if this is a bug but it seems to be. It occurs when you try to plot a STIDF object that contains a polygon with a hole and both a start and end timestamp. You will get an error like this:

Reprojecting to +proj=longlat +datum=WGS84 ...
Writing to KML...
Error in sprintf("<Placemark><name>%s</name><styleUrl>#poly%s</styleUrl><TimeSpan><begin>%s</begin><end>%s</end></TimeSpan><Polygon><extrude>%.0f</extrude><tessellate>%.0f</tessellate><altitudeMode>%s</altitudeMode><outerBoundaryIs><LinearRing><coordinates>%s</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark>", :
arguments cannot be recycled to the same length

It seems that the culprit is the last sprintf which incorrectly passes TimeSpan.begin and TimeSpan.end instead of the expanded TimeSpan.begin.l, and TimeSpan.end.l. The fixed line should read:

txt <- sprintf("<Placemark><name>%s</name><styleUrl>#poly%s</styleUrl><TimeSpan><begin>%s</begin><end>%s</end></TimeSpan><Polygon><extrude>%.0f</extrude><tessellate>%.0f</tessellate><altitudeMode>%s</altitudeMode><outerBoundaryIs><LinearRing><coordinates>%s</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark>",
unlist(poly_names.l), 1:sum(unlist(pvn)), unlist(TimeSpan.begin.l),
unlist(TimeSpan.end.l), rep(as.numeric(extrude), sum(unlist(pvn))),
rep(as.numeric(tessellate), sum(unlist(pvn))),
rep(altitudeMode, sum(unlist(pvn))), paste(unlist(coords)))

Dave

Comments:

No Comments Have Been Posted

Attached Files:

Changes

No Changes Have Been Made to This Item

Thanks to:
Vienna University of Economics and Business Powered By FusionForge