Title: | Preserving Attribute Values: Converting KML to Shapefile |
---|---|
Description: | The developed function is designed to facilitate the seamless conversion of KML (Keyhole Markup Language) files to Shapefiles while preserving attribute values. It provides a straightforward interface for users to effortlessly import KML data, extract relevant attributes, and export them into the widely compatible Shapefile format. The package ensures accurate representation of spatial data while maintaining the integrity of associated attribute information. For details see, Flores, G. (2021). <DOI:10.1007/978-3-030-63665-4_15>. Whether for spatial analysis, visualization, or data interoperability, it simplifies the conversion process and empowers users to seamlessly work with geospatial datasets. |
Authors: | Nirmal Kumar [aut, cph], Nobin Chandra Paul [aut, cre] |
Maintainer: | Nobin Chandra Paul <[email protected]> |
License: | GPL (>= 2.0) |
Version: | 0.1.0 |
Built: | 2024-11-27 06:31:15 UTC |
Source: | CRAN |
Conversion from KML to Shapefile While Preserving Attribute Values
kml_to_shape(data_kml, outputShape)
kml_to_shape(data_kml, outputShape)
data_kml |
Path to the KML file |
outputShape |
Path to save the output shapefile |
A shapefile with extracted attributes
1. Flores, G. & Gallardo, C. (2021). Creating Shapefile Files in ArcMap from KML File Generated in My Maps. In Advances in Emerging Trends and Technologies: Proceedings of ICAETT 2020 (pp. 193-204). Springer International Publishing..<DOI:10.1007/978-3-030-63665-4_15> 2. Kumar et al. (2023). SpatGRID:Spatial Grid Generation from Longitude and Latitude List. R package version 0.1.0.
library(KMLtoSHAPE) # Example usage: data_kml <- system.file("extdata", "testkml.kml", package = "KMLtoSHAPE") outputShape <- file.path(tempdir(), "shapedata.shp") # Delete existing shapefile if it exists if(file.exists(outputShape)) file.remove(outputShape) # convert kml to shapefile test_data<-kml_to_shape(data_kml, outputShape)
library(KMLtoSHAPE) # Example usage: data_kml <- system.file("extdata", "testkml.kml", package = "KMLtoSHAPE") outputShape <- file.path(tempdir(), "shapedata.shp") # Delete existing shapefile if it exists if(file.exists(outputShape)) file.remove(outputShape) # convert kml to shapefile test_data<-kml_to_shape(data_kml, outputShape)
Conversion from KML to Shapefile after Extracting Attributes from a Description String based on a List of Attribute Names
kml_to_shape_gen(data_kml, outputShape, attribute_names)
kml_to_shape_gen(data_kml, outputShape, attribute_names)
data_kml |
Path to the KML file |
outputShape |
Path to save the output shapefile |
attribute_names |
A character vector of attribute names to extract |
A shapefile with extracted attributes
1. Flores, G. & Gallardo, C. (2021). Creating Shapefile Files in ArcMap from KML File Generated in My Maps. In Advances in Emerging Trends and Technologies: Proceedings of ICAETT 2020 (pp. 193-204). Springer International Publishing..<DOI:10.1007/978-3-030-63665-4_15> 2. Kumar et al. (2023). SpatGRID:Spatial Grid Generation from Longitude and Latitude List. R package version 0.1.0.
library(KMLtoSHAPE) # Example usage: data_kml <- system.file("extdata", "testkml.kml", package = "KMLtoSHAPE") outputShape <- file.path(tempdir(), "shapedata.shp") # Delete existing shapefile if it exists if(file.exists(outputShape)) file.remove(outputShape) # Specify attribute names attribute_names <- c("pH", "EC", "OC", "N", "P", "K") # convert kml to shapefile test_data<-kml_to_shape_gen(data_kml, outputShape,attribute_names)
library(KMLtoSHAPE) # Example usage: data_kml <- system.file("extdata", "testkml.kml", package = "KMLtoSHAPE") outputShape <- file.path(tempdir(), "shapedata.shp") # Delete existing shapefile if it exists if(file.exists(outputShape)) file.remove(outputShape) # Specify attribute names attribute_names <- c("pH", "EC", "OC", "N", "P", "K") # convert kml to shapefile test_data<-kml_to_shape_gen(data_kml, outputShape,attribute_names)