I have a csv of values, and I need to determine if a string-field is a well-known-text geometry representation. For example, if I have the following data:
name,info
"tom","POINT (30 10)"
"brad","linestring (30 10, 10 30, 40 40)"
That would I would be able to infer the first column as being a string, and the second column to be a shape.
What would be the best way to make this determination from a string? My initial thinking was a regular expression that has something like:
\w\s?\((\d|\,|\s|\(|\))+\)\s?
But perhaps it might just be simpler or more efficient to do something like:
is_shape = val.split('(').strip().lower() in SET_OF_ACCEPTABLE_SHAPES
What would be the most efficient way to do this determination?