Top 5 Recent Articles
ARTICLES CATEGORIES
- Algorithms (22)
- All (399)
- Biography (1)
- Blog (44)
- Business Requirements (1)
- Commentary (1)
- Conversion (2)
- Customers (2)
- Data Models (1)
- Education (2)
- GeoRaptor (13)
- GPS (1)
- Image Processing (2)
- Import Export (8)
- Licensing (2)
- LiDAR (1)
- Linear Referencing (4)
- Manifold GIS (3)
- Mapping (1)
- MySQL Spatial (7)
- Networking and Routing (including Optimization) (5)
- Open Source (18)
- Oracle Spatial and Locator (194)
- Partitioning (1)
- PostGIS (36)
- Projections (1)
- Published Articles (1)
- qGIS (1)
- Recommendations (1)
- Services (1)
- Software Change Log (1)
- Source Code (37)
- Space Curves (9)
- Spatial Database Functions (109)
- Spatial DB comparison (1)
- Spatial XML Processing (11)
- SQL Server Spatial (92)
- Standards (3)
- Stored Procedure (17)
- Tessellation or Gridding (10)
- Tools (2)
- Topological Relationships (1)
- Training (2)
- Triangulation (2)
KML
I have a package that will allow you to convert a single geometry into KML or create a whole KML document from a recordset containing many geometries.
It doesn’t do a whole lot, but it has been of interest to some users out there who have improved the original work.
DEFINE defaultSchema = ‘&1’ create or replace package KML authid current_user As Procedure Header( p_document_name In Varchar2, p_visibility In Integer := 1, p_open In Integer := 1, p_object_list In VarChar2 := 'POINT,LINE,POLYGON', p_colour In VarChar2 := 'ff00ff00', p_normal_mode In Integer := 1, p_point_scale In Number := 1.1, p_line_width In Integer := 4, p_polygon_fill In Integer := 0 ); /** * ==@==function : TO_KML * ==@==precis : Procedure takes a geodetic shape, converts it to a KML representation which * could be used within Google Earth and adds it to an internal document. * ==@==version : 1.0 * ==@==description: As per precis. If you need to handle projected data then I suggest you call the function * with the relevant Oracle projection call eg SDO_CS.TRANSFORM(geom,to_srid); * ==@==usage : Procedure To_KML(p_geometry In MdSys.Sdo_Geometry, * p_placemark_name In Varchar2, * p_description In Varchar2, * p_elevation In Number := 0.0 * ); * eg KML := CODESYS.geom.To_KML(shape,'My House','My house converted from oracle'); * ==@==param : p_geometry : MDSYS.SDO_GEOMETRY : An geodetic Sdo_Geometry object of any type. * ==@==history : Simon Greener - Feb 2007 - Original coding. * ==@==copyright : Free for public use **/ Procedure To_KML( p_geometry In MdSys.Sdo_Geometry, p_placemark_name In Varchar2, p_description In Varchar2, p_elevation In Number := 0.0 ); Function To_KML( p_geometry In MdSys.Sdo_Geometry, p_placemark_name In Varchar2, p_description In Varchar2, p_elevation In Number := 0.0 ) Return CLOB Deterministic; Procedure Footer; Function GetDocument Return CLOB Deterministic; End KML;End KML;
Here is an example of how to use it.
Prompt Test Geodetic points ... DECLARE CURSOR c_kml IS SELECT rownum as ID, PolyType, geom FROM GeodPoly2D a; BEGIN KML.Header('Geodetic 2D Poly'); FOR rec IN c_KML LOOP KML.TO_KML(rec.geom,'Polygon (' || rec.ID || ') of type ' || rec.polytype,'Test description' ); END LOOP; KML.Footer; dbms_output.put_line(SUBSTR(KML.GetDocument,1,250)); END; /
Documentation
- MySQL Spatial General Functions
- Oracle LRS Objects
- Oracle Spatial Exporter (Java + pl/SQL)
- Oracle Spatial Object Functions
- Oracle Spatial Object Functions (Multi Page)
- PostGIS pl/pgSQL Functions
- SC4O Oracle Java Topology Suite (Java + pl/SQL)
- SQL Server Spatial General TSQL Functions
- SQL Server Spatial LRS TSQL Functions