0

I have a data frame that I pulled from a MySQL database that has a feature geometry attribute. For example, here's one record's value for the geom attribute:

'POLYGON((-113.583914 33.786816,-113.58412 33.787018,-113.58412 33.786816,-113.583914 33.786816))'

All features in the table are polygons.

I have been searching but cannot find a clean way to create a spatial data frame from these coordinate strings.

damian
  • 21
  • 6
  • 1
    On the narrow question of how to create a `SpatialPolygons` object from that WKT string, see the function `readWKT()` in the **rgeos** package. – Josh O'Brien Aug 19 '15 at 17:12
  • @JoshO'Brien you should make that an answer – hrbrmstr Aug 19 '15 at 17:13
  • 1
    Thank you, I was able to find ample documentation now knowing that the geometry strings are called WKT. For example: http://gis.stackexchange.com/questions/58322/plotting-large-numbers-of-objects-on-a-chart-using-r-and-wkt-format/58539#58539 – damian Aug 19 '15 at 18:28
  • @damian Good to hear. Thanks for coming back to post the link to that useful answer that you found. – Josh O'Brien Aug 19 '15 at 22:29

0 Answers0