[R-sig-Geo] Importing and Handling DXF Map files in R

Roger Bivand Roger.Bivand at nhh.no
Thu May 11 19:25:45 CEST 2006


On Thu, 11 May 2006, Roger Bivand wrote:

> On Thu, 11 May 2006, Paolo Cavallini wrote:
> 
> > one possible way is passing through GRASS GIS (you need latest version from 
> > CVS, though).
> > pc
> 
> Agreed, converting from DXF through OGR (as in the rgdal package for R) is 
> not possible (http://www.remotesensing.org/gdal/ogr/drv_dxfdwg.html). 
> Depending on platform, there may be converters available, but not 
> unemcumbered. Since the data are said to be points, I wonder if Francisco 
> or the originator of the data if not him, can dump it as ASCII from the 
> CAD software - since there is no topology. 
> 
> A very good book that I certainly recommend is Bailey & Gatrell's 
> Interactive Spatial Data Analysis - their treatment of point pattern 
> analysis is easy to follow (including kernel densities), and most of their 
> point pattern examples are replicated in the examples of the splancs 
> package for R. I'm not sure how kernel2d scales for 70K points, though, 
> and feel that you may find the hexbin package in bioconductor an 
> alternative: it is something else, but is designed for lots of data:
> 
> http://www.bioconductor.org/repository/devel/vignette/hexagon_binning.pdf
> 
> and there seems to be a smoother there too.

Replying to my own question, kernel2d() scales brilliantly:

set.seed(1)
cores <- cbind(x=runif(300), y=runif(300))
out <- do.call("rbind", lapply(1:300, function(i) 
  cbind(x=cores[i,1]+rnorm(200, 0, runif(1, 0.001, 0.02)), 
  y=cores[i,2]+rnorm(200, 0, runif(1, 0.001, 0.02)))))
plot(out, pch=".")
plot(hexbin(out))
image(kernel2d(out, bboxx(bbox(out)), h0=0.05, 50, 50), 
  col=grey(99:1/100))

plot(hexbin()) 1.4 seconds 
image(kernel2d()) 1.0 seconds

and the new spkernel2d() wrapper makes it convenient to stack up kernel 
densities in a SpatialGridDataFrame and display with spplot().

> 
> Please let the list know how you decide to extract the point coordinates, 
> others will benefit from your experience.
> 
> Hope this helps,
> 
> Roger
> 
> > 
> > At 17:09, giovedì 11 maggio 2006, Francisco Javier Aguirre Navarro has 
> > probably written:
> > > Hello, I am a newby in the filed of spatial data analysis, could you please
> > > point me to the right libraries/functions in R  that allow me to import DXF
> > > maps  and analize spatial data related to these maps ? I would appreciaiate
> > > any internet references or books  that may give a good hands-on
> > > introduction to spatial data analysis, I have good knowledge of classical
> > > statistical methods. I need to analyze about 75000 data points scattered on
> > > a map area and I'd like to construct a "density" map of my variable of
> > > interest and eventually see how these densities change in time.
> > >
> > > Thank you very much for your help.
> > >
> > > Francisco J. Aguirre
> > > Bavaria, Bogota -  Colombia.
> > 
> 
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no




More information about the R-sig-Geo mailing list