Search code examples
rarcgiswinbugs

How can I convert the ArcGIS Shpae file to Arcinfo/Splus/Epimap format file to import adjajency matrix and Maps into WinBUGS


I want to convert the ArcGIS shapefile to Splus/ArcInfo/Epimap format so that I can input the adjacency matrix and maps into WinBUGS. WinBUGS can not read the ArcGIS shapefile directly. How can I do this using R or any software?


Solution

  • I found a solution for this at last

               install.packages("maptools", repos ="https://packagemanager.posit.co/cran/2023-10-13")
    
               library(maptools)
    
               library(sp)
    
               usa_counties <- readShapePoly("E:\\USA_Counties.shp", IDvar = 
                "CNTY_FIPS")
    
               # Convert to WinBUGS S-Plus format
              splus_data <- sp2WB(as(usa_counties, "SpatialPolygons"), filename 
               = "E:\\USA_Counties.txt")