Interfacing Grass-GIS and R: Road Descriptive Statistical Representation based on Slope

As the demand of open-source GIS has been increased, the integration of GIS and statistical data analysis i.e., code via Comprehensive R Archive Network (CRAN) is also increasing day by day. An example of Road statistical representation based on slope has been presented in this paper to enhance the implementation of R-Grass integration by linking two complex functions. Earlier S and S-PLUS code were available for integration with Grass-GIS for raster data values but in loose coupled form. Here this integration is performed in MS windows platform but could perform in Ubuntu or Linux in future work. The interface used there is based on statistical data analysis system working under Grass-GIS environment. The basic difference in Grass-GIS and R is that former uses file system i.e., raster and vector while later is used for mapping and static memory allocation via garbage collector. Both together prove very beneficial for statistical data analysis with better visualization of file system. Grass-GIS is basically responsible for spatial modelling, visualization, graphics production with data management and image processing of raster/vector data and also termed as project of the Open source Geospatial Foundation. Grass-GIS provides more than 350 functions and tools for map rendering, image monitoring with capability to manipulate, create, store raster/vector spatial data on a both window and command line graphical interface. It works based on Location/Mapset workgroup for enabling sharing over network via keeping location with a Mapsets on a central server. Grass supports libraries i.e., GDAL for raster data and OGR for vector data analysis. R is basically used for advanced Geostatistical, mathematical and Geospatial data analysis, computing and graphics that are not possible on Grass-GIS. R is responsible for data manipulation with effective handling and storage capability of operators with the help of different tools and effective and fully functional programming language having lots of loops, recursive functions with input and output facilities. R provides powerful flexibility in statistical analysis i.e., correlation, *Corresponding author: Kumari Pritee, Research Scholar, Centre for Transportation Systems (CTRANS), IIT Roorkee, Uttarakhand, India, Tel: 9410560652; E-mail: priteegeo.kumari23@gmail.com


Introduction
As the demand of open-source GIS has been increased, the integration of GIS and statistical data analysis i.e., code via Comprehensive R Archive Network (CRAN) is also increasing day by day. An example of Road statistical representation based on slope has been presented in this paper to enhance the implementation of R-Grass integration by linking two complex functions. Earlier S and S-PLUS code were available for integration with Grass-GIS for raster data values but in loose coupled form. Here this integration is performed in MS windows platform but could perform in Ubuntu or Linux in future work. The interface used there is based on statistical data analysis system working under Grass-GIS environment. The basic difference in Grass-GIS and R is that former uses file system i.e., raster and vector while later is used for mapping and static memory allocation via garbage collector. Both together prove very beneficial for statistical data analysis with better visualization of file system. Grass-GIS is basically responsible for spatial modelling, visualization, graphics production with data management and image processing of raster/vector data and also termed as project of the Open source Geospatial Foundation. Grass-GIS provides more than 350 functions and tools for map rendering, image monitoring with capability to manipulate, create, store raster/vector spatial data on a both window and command line graphical interface. It works based on Location/Mapset workgroup for enabling sharing over network via keeping location with a Mapsets on a central server. Grass supports libraries i.e., GDAL for raster data and OGR for vector data analysis. R is basically used for advanced Geostatistical, mathematical and Geospatial data analysis, computing and graphics that are not possible on Grass-GIS. R is responsible for data manipulation with effective handling and storage capability of operators with the help of different tools and effective and fully functional programming language having lots of loops, recursive functions with input and output facilities. R provides powerful flexibility in statistical analysis i.e., correlation,

Abstract
As lots of GIS (Geographic Information systems) applications for statistical purposes are available in the market but still there is lots of demand of integration of GRASS-GIS i.e., Geographic Resources Analysis support GIS with the R statistical package. Many researchers always want to explore, analyse, complex analysis of spatial data with statistical problems and dealing with large areas in less amount of time and memory within individual software but this is not possible without integration. However, the integration of GRASS-GIS and R statistical package play a very important role to fulfil all needs related to computation, analyse, retrieve, image processing, graphics production and query spatial data. GRASS is open source software freely available, used for data management, analysis of geospatial data, spatial modelling with visualization whereas R (Open Source Package) enables all statistical environments with better quality plots providing linear or non-linear modelling, time series analysis with classification and clustering. In this paper, GRASS-GIS i.e., GIS subsystem act as a simple interface for R i.e., statistical computing subsystem for both raster and vector spatial data which provides commands to GRASS program via R system () function. Integration also enables all R plotting and analytical functions i.e., kriging prediction; kernel density pattern estimation etc. and proves very beneficial with the perception of research and educational purposes. It is also capable to provide introductory knowledge of both open software's packages with their flexibility, robustness capability. This paper also introduces an example of classification of roads on the basis of slope via box plot representation by interfacing R in GRASS Environment.

Examples and Results
The different examples from different literatures have been presented to explain the application of interfaces. An interface between Grass-GIS and R statistical package has been implemented to provide gridded output i.e., kernel density patterns, bicubic spline interpolation etc. with the help of constructed R code and wrapper functions packages for plotting [1]. An example has been presented for illustrating graphics types and statistical outputs on the basis of quantile-quantile plots for nine elements from a geochemical survey used for accessing sample populations distributions using R statistical computing language and object oriented programming environment [2]. A methodology for the GIS via Grass-GIS and statistics via R has been proposed in metamorphic analysis using different parameters i.e., hypsometry, slope, aspect, swath profiles, lineaments and drainage density, surface roughness, isobase and hydraulic gradient etc. and some open source tools for easy access from anywhere [3].

An intermediate analytical environment has
Installation can be checked with the help of library functions i.e., library ("ctv").
Here we have used Grass 6. After installing all packages, Grass interface has been created inside R and R-interface has been created inside Grass. So, in that case R can be called from Grass and Grass can be called from R. First of all, R has been called from Grass via providing full path to the R startup executable and changing "\" to "/" in the specified path. > e x e c G R A S S ( "g . m l i s t , p a r a m e t e r s = l i s t ( t y p e = "v e c t", pattern="precip*")) >my_vmaps ←execGRASS("g.mlist, parameters=list(type="vect", pattern=$)) >attributes(my_vmaps) NULL > attributes(my_vmaps)$resOut NULL >execGRASS("g.mlist", parameters=list(type="rast")) Aspect, bugsites, density, elevation.10m, elevation.dem, elevation. dted, roads, slope, geology >Roadsslpoe ←readRAST6(c("roads", "slope"), cat=c(TRUE, FALSE), ignore.stderr=TRUE, >image(roadsslope, attr = 2, col = terrain.colors(20)) > title("Road slope") ( Figure 2) been developed using R, Grass-GIS 5 and some libraries i.e., GDAL for interpolating data into discretised continuous surfaces via sketching some spatial data analysis i.e., point pattern, continuous surface, areal/ lattice etc. [4][5][6]. A modular system using GrassGIS as GIS subsystem and R as statistical subsystem has been developed to achieve efficient statistical approaches i.e., linear and nonlinear modelling, classical statistical tests, time-series analysis, classification, cluster analysis etc. and production of publication quality graphics with both mapping and statistics functions that forms application for geomorphic research [7].

Interface Functions
Interface of statistical software i.e., R and GIS software i.e., Grass-GIS, Quantum GIS etc. has been discussed earlier for metamorphic analysis and many other analysis. R-Grass interface provides two functions i.e., first to run statistical functions according to R objects in memory space by transferring Grass data to R and after that transfer the result back to R and second to use R as a scripting language for Grass using execGRASS (). Here code has been written via R as a scripting language. First of all R has been installed on the MS windows i.e., windows 7. With the installation of R, many add-ons have been prebuilt and distributed via CRAN (The Comprehensive R Archive Network) network of mirrors. Then, number of packages and views has been installed under R for Grass-GIS6 functions using install.packages () and install.views () and update.views (). Many packages e.g., sp, maptools and rgdal has been installed for spgrass6 installation. There are many interface functions that has been used there for interfacing Grass-GIS and R. Interfacing has been done through R add-on packages i.e., the spgrass6 for R-Grass6 [8][9][10].
Following code has been written to perform this operation: First packages required for R-grass interface has been installed directly from internet via function i.e., install.packages. pkgs←c('akima' , 'spgrass6' , 'RODBC' , 'VR' , 'gstat') in case of grass6 whereas in case of grass 7, spgrass6 is replaced by rgrass7.

Results and Discussion
Here, a box plot for different roads with variations in slope has been represented via quartiles. Box plot is basically a simple representation of numerical data graphically via quartiles. Here, some lines in box plots extending vertically outside the boundary of lower and upper quartiles is basically termed as whiskers and that's why this diagram is also named as box and whisker plot diagram. The spacing between different parts of box is termed as spread or degree of dispersion. Box plots consist of lower hinge i.e., 25th percentile, upper hinge i.e., 75th percentile and 50th percentile. The bottom and top of box is called as first and third quartile respectively whereas the middle between these two quartiles is basically defined as a median or second quartile and difference or variation between first and third quartile is called as an interquartile range. Any additional data between whiskers has been represented via dot, small circle etc. The whiskers are generally represented by a formula (±1.58×IQR÷√n) but the length of upper and lower whiskers can be termed as 1.5×IQR×e3MC, 1.5×IQR×e-4MC if MC≥0 && 1.5×IQR×e4MC, 1.5×IQR×e-3MC if MC≤0 respectively.

Conclusions
Geospatial data analysis via box plot representation via GRASS-GIS and R interface were explained in this article. With the study of this integration of Grass-GIS and R, popularization of open source software has been increased in the perspective of new research development related to road having different slope related information system. R directly supports non-spatial data but Integration with Grass-GIS is needed for spatial data because it is not possible for R directly to spend a large amount of time with programming routines especially for large areas i.e., road network that is quickly confronted with memory problems. It proves very efficient for statistical approaches in different fields i.e., terrain modelling environment, road classification according to slopes and publication based quality graphics. The combination of both open source tools i.e., Grass and R in one modular system proves very beneficial for researchers for using Grass-GIS capabilities with the strength of R in case of mapping, realistic sized statistics and spatial statistics problems. Grass-GIS database structure is basically best represented via indexing the site, line or polygon by R as data frames. Future work will be extension of geospatial analysis for reading data into R directly in binary form with raster and vector data that helps in coordination with other database integration packages in R-GRASS. Extension of graphical user interfaces so that both GRASS and R users can use command line interfaces simultaneously.