Knowledge Base



KB10679 - Get shape WKT geometry in a given projection.

Implement this function:

function MyExportToWKT( const _shp : TGIS_Shape ) : String ;
var
  tmp : TGIS_Shape ;
  i,j : Integer ;
begin
 tmp := _shp.CreateCopy ;
  try
    tmp.Lock( gisLockInternal );
    try
      tmp.Reset ;

      for j := 0 to _shp.GetNumParts - 1 do begin
        tmp.AddPart ;
        for i:= 0 to _shp.GetPartSize( j ) - 1 do begin
          tmp.AddPoint( _shp.GetPoint( j, i ) ) ;
        end ;
      end ;
    finally
      tmp.Unlock;
    end ;

    Result := tmp.ExportToWKT ;
  finally
    tmp.Free ;
  end ;
end ;

 
Created: February 08, 2006, Modified: September 16, 2015
follow us on Facebook  follow us on Twitter  follow us on Google +  follow us on LinkedIn  Embarcadero