sf icon indicating copy to clipboard operation
sf copied to clipboard

How to read/parse JSON geometry data from a csv file

Open kbzsl opened this issue 3 years ago • 2 comments

Sorry, a novice question. I spent some time reading through the documentation/vignette, but I haven't manage to find an answer.

I have csv files where one string column contains the geometry (polygons) data in JSON format, similar to what is specified in the ESRI document. Most probably the data was exported from ArcGIS.

{
"rings" : [ 
 [ [-97.06138,32.837], [-97.06133,32.836], [-97.06124,32.834], [-97.06127,32.832], [-97.06138,32.837] ], 
 [ [-97.06326,32.759], [-97.06298,32.755], [-97.06153,32.749], [-97.06326,32.759] ]
],
"spatialReference" : {"wkid" : 4326}
}

I am getting a warning message when I an trying to read using the st_read()

Warning message:
no simple feature geometries present: returning a data.frame or tbl_df 

How this type of data can be read in or the geometry string parsed?

kbzsl avatar May 02 '22 21:05 kbzsl

What makes you think this package would support this?

edzer avatar May 03 '22 07:05 edzer

Just I hoped that the sf package can parse this format too, because it handles many different sources , just didn’t succeed to find the right parameters, I assume that this means that the sf package does not support this format. Is it correct? Can you suggest any other package? (I would rather use an existing package than to write a parser for this particular format) Thank you.

kbzsl avatar May 03 '22 07:05 kbzsl