4 Replies Latest reply on May 31, 2013 9:30 AM by 1010855

SVG Path to Oracle Spatial conversion

Need advice for a particular problem.

I am trying to convert an elliptical arc from one geometry format (SVG) to another (SDO_GEOMETRY). I need to store the following elliptical curve in SDO_GEOM. This geometry is in SVG format and the parameter details are as follows,

*<path d="M 20,8 A 571,250 30.0 1 0 -1122,8" />*

X1, Y1 = 20, 8 (starting co-ordinate)
X2, Y2 = -1122, 8 (ending co-ordinate)
X-axis rotation = 30.0 (here the x-axis is kept as 0 degrees. Hence no rotation. But the x-axis can be rotated to change the elliptical curve)
large-arc-flag = 1 ( 1 specifies to use the large sweep 180 degrees or greater, 0 specifies to use the small sweep less than 180 degrees)
sweep-flag = 0 (1 specifies that the arc is drawn clockwise, 0 specifies arc is drawn counter-clockwise)

Now in SDO_GEOMETRY, an arc is created using 3 points. I have the starting and ending X,Y coordinates. I need to compute the third point based on the above parameters. Any pointers will be very helpful. Are there any available library which converts SVG path into SDO_GEOMETRY?
• 1. Re: SVG Path to Oracle Spatial conversion
Hi 1007852,

I am not aware of any libraries that might do this, but using an Arc will not represent your elliptical curve properly. And seeing the two radii differ quite greatly (571 versus 250), if you simply convert this to an arc it will look like your original geometry. You can deal with this by converting it to stroked polygon, which will best match your elliptical arc. Googling should give you plenty of algorithms to use for the exact calculations.

HTH,
Stefan
• 2. Re: SVG Path to Oracle Spatial conversion
Thanks Stefan. I got you on the concept. I need to store a polyline for the elliptical arc in Oracle. Any link to such an algorithm for the calculations.

Regards,
Ananda
• 3. Re: SVG Path to Oracle Spatial conversion
Hi Ananda,

Maybe you can find something [url http://mtshome.sw3solutions.com/cppComputerGraphics.html]here. I have never had the need to do something like this, so don't have anything for you. If this site doesn't help you, you can always try [url http://www.google.com]Google.

HTH,
Stefan
• 4. Re: SVG Path to Oracle Spatial conversion
It is done finally. Thanks.