Don MacQueen wrote:
I have an XML file that has within it the coordinates of some polygons
that I would like to extract and use in R. The polygons are nested
rather deeply. For example, I found by trial and error that I can
extract the coordinates of one of them using functions from the XML
Hi,
You also might want to check R4X:
# install.packages(R4X, repos=http://R-Forge.R-project.org;)
require( R4X )
x - xml(http://code.google.com/apis/kml/documentation/KML_Samples.kml;)
coords - x[Polygon///coordinates/# ]
data - sapply( strsplit( coords, (,|\\s+) ), as.numeric )
Romain
Romain Francois wrote:
Hi,
You also might want to check R4X:
# install.packages(R4X, repos=http://R-Forge.R-project.org;)
require( R4X )
x - xml(http://code.google.com/apis/kml/documentation/KML_Samples.kml;)
coords - x[Polygon///coordinates/# ]
data - sapply( strsplit( coords, (,|\\s+) ),
Wacek Kusnierczyk wrote:
Don MacQueen wrote:
I have an XML file that has within it the coordinates of some polygons
that I would like to extract and use in R. The polygons are nested
rather deeply. For example, I found by trial and error that I can
extract the coordinates of one of them using
Duncan Temple Lang wrote:
Wacek Kusnierczyk wrote:
Don MacQueen wrote:
I have an XML file that has within it the coordinates of some polygons
that I would like to extract and use in R. The polygons are nested
rather deeply. For example, I found by trial and error that I can
extract the
Wacek Kusnierczyk wrote:
Duncan Temple Lang wrote:
Wacek Kusnierczyk wrote:
Don MacQueen wrote:
I have an XML file that has within it the coordinates of some polygons
that I would like to extract and use in R. The polygons are nested
rather deeply. For example, I found by trial and error
Duncan Temple Lang wrote:
not really: the xpath pattern '//coordinates' does say 'find all
coordinates nodes searching from the root', but the root here is not the
original root of the whole document, but each polygon node in turn.
try:
root = xmlInternalTreeParse('
root
I have an XML file that has within it the coordinates of some
polygons that I would like to extract and use in R. The polygons are
nested rather deeply. For example, I found by trial and error that I
can extract the coordinates of one of them using functions from the
XML package:
doc -
A bit over a year ago I got useful advice from Gabor Grothendieck and
Duncan Temple Lang in this thread:
http://finzi.psych.upenn.edu/R/Rhelp02/archive/117140.html
If the coordinates are nested deeply, then it probably safer to search
for a specific tag or tags that are just above them .
9 matches
Mail list logo