sylvain willart
2010-Mar-02 18:15 UTC
[R] how to import map data (maptools?) from a html set of 'coords'
Dear R users, I would like to draw map and import it in maptools/spatstat packages. The 'raw data' I have come from a web page (<map>...</map>) and are basically a list of coordinates of a polygon. I would like to know how to import them in R; I checked the maptools packages, but all the examples use existing .dbf files. I just have a (serie of) text file(s) looking like this: For example, for the French Region Burgundy: <area href="region.asp?reg=26" shape="poly" title="Bourgogne" alt="Bourgogne" coords="208,121,211,115,221,113,224,115,225,120,229,122,232,128,251,125,255, 130,256,136,266,138,268,148,267,154,263,160,267,168,267,180,262, 175,256,178,254,184,248,184,243,187,237,187,232,185,234,181,227, 171,216,171,212,166,211,155,208,149,208,135,211,132,213,125,208, 121"> any idea welcome, sylvain (If anayone is interested with that type of data, they're available at the INSEE website along with loads of information on the population and economy of each region)
Michael Denslow
2010-Mar-03 10:44 UTC
[R] how to import map data (maptools?) from a html set of 'coords'
Hi Sylvian, On Tue, Mar 2, 2010 at 1:15 PM, sylvain willart <sylvain.willart at gmail.com> wrote:> Dear R users, > > I would like to draw map and import it in maptools/spatstat packages. > > The 'raw data' I have come from a web page (<map>...</map>) and are > basically a list of coordinates of a polygon. > > I would like to know how to import them in R; I checked the maptools > packages, but all the examples use existing .dbf files. > > I just have a (serie of) text file(s) looking like this: > > For example, for the French Region Burgundy: > > <area ?href="region.asp?reg=26" shape="poly" title="Bourgogne" alt="Bourgogne" > coords="208,121,211,115,221,113,224,115,225,120,229,122,232,128,251,125,255, > 130,256,136,266,138,268,148,267,154,263,160,267,168,267,180,262, > 175,256,178,254,184,248,184,243,187,237,187,232,185,234,181,227, > 171,216,171,212,166,211,155,208,149,208,135,211,132,213,125,208, > 121">It is not clear (to me) from your example what kind of file this is. Maybe XML, it does not look like GML. readOGR() in the rgdal package may be a better route to explore, but you need to determine what file structure is first.> any idea welcome, > > sylvain > > (If anayone is interested with that type of data, they're available at > the INSEE websiteI can not easily find an example on this site. Perhaps you could provide a direct link to the file. Lastly, I suspect that the r-sig-geo mailing list would get you some better answers. Michael -- Michael Denslow I.W. Carpenter Jr. Herbarium [BOON] Department of Biology Appalachian State University Boone, North Carolina U.S.A. -- AND -- Communications Manager Southeast Regional Network of Expertise and Collections sernec.org 36.214177, -81.681480 +/- 3103 meters