Go to content Go to navigation and search

Home

Free Software Download

Download Code, Packages and Installers

Object Documentation

Package Documentation

CENTROID
COGO
EXPORTER
GEOM
KML
NETWORK
SDO_ERROR
Spatial Companion For Oracle (SC4O)
TOOLS

Articles

    New versions of LINEAR, CENTROID and GEOM etc packages
    TESSELATE and CENTROID package updates
    Applying and Extending Oracle Spatial: Source Code Problem
    CENTROID package use with ESRI's sde.st_geometry
    Changes to CENTROID and TESSELATE packages
    CENTROID Package now returns centroid of multi-linestring
    New versions of PL/SQL packages uploaded
    New Release of Free PL/SQL Packages
    New version of PL/SQL packages released
    New Version PL/SQL Spatial packages released
    New PL/SQL Package Upload
    PL/SQL Spatial Types and Packages
    Update to PL/SQL Packages
    New PL/SQL Packages
    VB6 Oracle Spatial or Locator OO4O code
    Spatial PL/SQL Packages by Example
    Catalog Registry Tool
    Image Catalog Tool
    Oracle Spatial PL/SQL and VB6 Source Code


Search

Browse

RSS / Atom

Email me

textpattern

Creative Commons License
All Blog Articles, Data Models and Free Source Code by Simon Greener, The SpatialDB Advisor is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

KML

Monday August 15 2011 at 06:25

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; * @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;

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;
/

Creative Commons License

post this at del.icio.uspost this at Diggpost this at Technoratipost this at Redditpost this at Farkpost this at Yahoo! my webpost this at Windows Livepost this at Google Bookmarkspost this to Twitter

Comment

META HTTP-EQUIV=