[mapguide-users] Re: how to convert agf to wkt?

Jonio, Dennis (Aviation) DJonio at miami-airport.com
Mon May 23 07:12:24 EDT 2011


The WKT string that you have posted does not pass: SOD_UTIL.VALIDATE_WKTGEOMETRY. I do not know what version of Oracle you are using but if my  memory serves the WKT functions and procedures were/are very limiting. I do not believe that the 10g versions support curves. In addition I thing the syntax is somewhat different than AGF/FGF. 

From the Oracle docs:

To be valid, the input geometry must be in the well-known text (WKT) format, as defined by the Open Geospatial Consortium and the International Organization for Standardization (ISO).

This function is patterned after the SQL Multimedia recommendations in ISO 13249-3, Information technology - Database languages - SQL Multimedia and Application Packages - Part 3: Spatial.

To validate a geometry in the well-known binary (WKB) format, use the SDO_UTIL.VALIDATE_WKBGEOMETRY <http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14255/sdo_util.htm#BJEJIBCC>  function.

 

 

From: mapguide-users-bounces at lists.osgeo.org [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of mahpooya
Sent: Monday, May 23, 2011 6:39 AM
To: mapguide-users at lists.osgeo.org
Subject: [mapguide-users] Re: how to convert agf to wkt?

 

Let me introduce my code
I use php and oracle database.
I have an AGF geometry string ($geometryString in below code) that contain a circular sector <http://en.wikipedia.org/wiki/File:Circle_arc.svg> ;
But oracle is not support AGF text format.
Oracle have "SDO_UTIL.FROM_WKTGEOMETRY" that input geometry from wkt.
I want to convert AGF to WKT and insert it to database.
How can i convert it?

$geometryString="CURVEPOLYGON ((67.894181638047 32.989785090909 (LINESTRINGSEGMENT (70.229107873737 33.852692612795), CIRCULARARCSEGMENT (70.38340259381948 32.973385371885676 , 70.2175355016466 32.096187451063344))))";

$conn = oci_pconnect('gis', '123456', '127.0.0.1:1521/orcl');

if (!$conn) {
    $e = oci_error();
    trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
$sql='INSERT INTO "GIS"."P" ("ID_AUTO", "MYINT", "MYSTR", "GEOMETRY") VALUES (1, 123, \'asd\', SDO_UTIL.FROM_WKTGEOMETRY(\''.$geometryString.'\') )';

$stid = oci_parse($conn, $sql);

$r = oci_execute($stid, OCI_NO_AUTO_COMMIT);
if (!$r) {
    $e = oci_error($stid);
    oci_rollback($conn); // rollback changes
    trigger_error(htmlentities($e['message']), E_USER_ERROR);
}

 

________________________________

View this message in context: Re: how to convert agf to wkt? <http://osgeo-org.1803224.n2.nabble.com/how-to-convert-agf-to-wkt-tp6391716p6393870.html> 
Sent from the MapGuide Users mailing list archive <http://osgeo-org.1803224.n2.nabble.com/MapGuide-Users-f1803227.html>  at Nabble.com.

________________________________

Email Scan by McAfee 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20110523/6045e3bb/attachment.html


More information about the mapguide-users mailing list