I have a mysql table containing polygons some of which are open and I need to close them. Presumably by appending the “StartPoint” to the end of the “Linestring” and rewriting as a polygon. Any ideas?
Sure I can grab out and test a polygon to see if its open or closed with
SELECT ExteriorRing(SHAPE) into @testshape from tablename where OGR_FID=1;
SELECT (StartPoint(@testshape)) INTO @SP;
SELECT (EndPoint(@testshape)) INTO @EP;
SELECT @EP=@SP as myIsRing;
ok fine but when it’s open I need to append the Startpoint to the end of the line string in order to close the polygon. Is there a way to append that “closure” point and create a closed polygon?
Might be worth noting that I tried (as per the man page)
SELECT UNION(@testshape,@SP) INTO @newshape;
And got the standard syntax error ERROR 1064 (42000) as though my version didnt accept the UNION function.
Sorry everyone, Threw a couple more hours at the problem and got the following
Not exactly clean but it worked and can be tested with: