Showing posts with label SQL. Show all posts
Showing posts with label SQL. Show all posts

Thursday, April 4, 2013

Circle polyline in Oracle?

Did you ever want to create a circle polyline to Oracle spatial datatype SDO_GEOMETRY? I did! But I had a little problem - I had only to vertices. The problem is this:
If you want to create polyline circle in Oracle, you need to create two opposite arcs. And if you want to create two arcs you need to know three points, because each circular arc is in Oracle described using three coordinates: First is the arc's start point, second is any point on the arc, and the third is the arc's end point.
This SQL-script should provide you the way to create a polyline circle from two vertices laying on the circle:

select mdsys.sdo_geometry(2002,YOUR_SRID,null,mdsys.sdo_elem_info_array(1,2,2),mdsys.sdo_ordinate_array(
X1,Y1, --Vertex number 1
(X2 - X1) / 2 + X1 + (sqrt(power(X2-X1,2) + power(Y2-Y1,2))) / 2 * cos(atan2(Y2-Y1,X2-X1) + 3.141592653589793/2),
(Y2 - Y1) / 2 + Y1 + (sqrt(power(X2-X1,2) + power(Y2-Y1,2))) / 2 * sin(atan2(Y2-Y1,X2-X1) + 3.141592653589793/2), --Vertex number 2
X2,Y2, --Vertex number 3
(X1 - X2) / 2 + X2 + (sqrt(power(X1-X2,2) + power(Y1-Y2,2))) / 2 * cos(atan2(Y1-Y2,X1-X2) + 3.141592653589793/2),
(Y1 - Y2) / 2 + Y2 + (sqrt(power(X1-X2,2) + power(Y1-Y2,2))) / 2 * sin(atan2(Y1-Y2,X1-X2) + 3.141592653589793/2), --Vertex number 4
X1,Y1  --Vertex number 5
)) from TABLE_WITH_VERTICES




That's it! Keep drawing... :)

Saturday, December 8, 2012

AutoCAD MAP3D and Microsoft SQL Server:
2. Installation of Microsoft SQL Server 2008 R2

 Let's install MS Server which we downloaded in the past blog-post. I have to repeat again and again, ensure yourself that you downloaded Microsoft SQL Server 2008 R2 SP1, because Auto-CAD MAP3d supports only this version!

Wednesday, December 5, 2012

AutoCAD MAP3D and Microsoft SQL Server:
1. Download MS SQL server

AutoCAD MAP 3D, the GIS application, now supports not only ORACLE server, but Microsoft SQL Server as well. This is great steps for Autodesk and for us, users, either. Users now can work with enterprise industry models on SQL Server, with more powerful and enhanced FDO provider, as they could use it with Oracle systems before. Let's take a few steps forward.
I hope, you can do it! :)

So question is: How to download installation file for Microsoft SQL Server?

Sunday, December 2, 2012

TIP: Draw polyline in AutoCAD from entry in ORACLE

Sometime you just need to draw complicated polyline with lot of vertices in AutoCAD (possibly MAP 3D), but you have all you coordinates saved in attribute with data type SDO_GEOM.