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

mahpooya mahpooya at gmail.com
Mon May 23 06:38:47 EDT 2011


Let me introduce my code

I use php and oracle database.

I have an AGF geometry string ($geometryString in below code) that contain a 
http://en.wikipedia.org/wiki/File:Circle_arc.svg circular sector
;

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: http://osgeo-org.1803224.n2.nabble.com/how-to-convert-agf-to-wkt-tp6391716p6393870.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20110523/301deb85/attachment.html


More information about the mapguide-users mailing list