


Hi all, 
I got a question about conversion from a "spatialploygondatafrme" object to a "geojson" string with "rgdal" library.
Currently I am doing in this way (code attached as below), using writeOGR to write the targetDataFrame to a temporary file, and then read the geojson string from the file. It is not graceful indeed.
Is there any way to handle this conversion beautifully? 
Thanks a heap!!!

tmpFilePath = "./dump.geojson"
geoJSONStr = ""
  if(inherits(targetDataFrame, "Spatial")) {
    if(file.exists(tmpFilePath)) file.remove(tmpFilePath)   
    writeOGR(obj=targetDataFrame, dsn=tmpFilePath, layer="dump", driver = "GeoJSON",  check_exists=TRUE, overwrite_layer=TRUE)    
    geoJSONStr = readChar(tmpFilePath, file.info(tmpFilePath)$size)
  }
yiqunc 		 	   		  
	[[alternative HTML version deleted]]

