NAME
Geo::OGR - A part of the Perl interface to the GDAL/OGR library.
SYNOPSIS
use Geo::GDAL;
ABSTRACT
This module is a part of the Perl bindings to the GDAL library. The GDAL modules allows you to access and manipulate from Perl all geospatial data that the installed GDAL library is configured to read/write.
STATUS
This module is beta quality. As most of the names and calling conventions come directly from the underlying GDAL library they are quite stable and will continue to work like the do now. However, many things could, should, and will be made more perlish.
Generally, those methods which are documented, have been tested. If the method or constructor you are looking for is not documented, perhaps there is another way of doing what you want to do.
PACKAGE METHODS
Note: some arguments are optional and have a default value. This is illustrated like this:
SomeMethod(arg1, arg2 = 4);
arg1 is a required argument and an example or a variable with illustrative name is given
arg2 is optional and if left off, will get the value 4 (in this case)
- CreateGeometryFromWkb
- CreateGeometryFromWkt
- CreateGeometryFromGML
- GetDriverCount
- GetOpenDSCount
- SetGenerate_DB2_V72_BYTE_ORDER
- RegisterAll
-
Done by default.
- GetOpenDS
- Open
-
$datasource = Geo::OGR::Open('directory', $update = 0);
- GetDriverByName
- GetDriver
CONSTANTS
Access as $Geo::OGR::<constant>
- wkb25Bit
- wkbUnknown
- wkbPoint
- wkbLineString
- wkbPolygon
- wkbMultiPoint
- wkbMultiLineString
- wkbMultiPolygon
- wkbGeometryCollection
- wkbNone
- wkbLinearRing
- wkbPoint25D
- wkbLineString25D
- wkbPolygon25D
- wkbMultiPoint25D
- wkbMultiLineString25D
- wkbMultiPolygon25D
- wkbGeometryCollection25D
- OFTInteger
- OFTIntegerList
- OFTReal
- OFTRealList
- OFTString
- OFTStringList
- OFTWideString
- OFTWideStringList
- OFTBinary
- OJUndefined
- OJLeft
- OJRight
- wkbXDR
- wkbNDR
- OLCRandomRead
- OLCSequentialWrite
- OLCRandomWrite
- OLCFastSpatialFilter
- OLCFastFeatureCount
- OLCFastGetExtent
- OLCCreateField
- OLCTransactions
- OLCDeleteFeature
- OLCFastSetNextByIndex
- ODsCCreateLayer
- ODsCDeleteLayer
- ODrCCreateDataSource
- ODrCDeleteDataSource
CLASSES
Geo::OGR::Driver
- name
-
$driver->{name}
- CreateDataSource
-
$datasource = $driver->CreateDataSource('directory', $options = []);
- CopyDataSource
- Open
- DeleteDataSource
- TestCapability
- GetName
Geo::OGR::DataSource
- GetRefCount
- GetSummaryRefCount
- GetLayerCount
-
$n = $datasource->GetLayerCount;
- GetName
- DeleteLayer
- CreateLayer
-
$layer = $datasource->CreateLayer('layer_name', $spatial_reference = undef, $geom_type = $Geo::OGR::wkbUnknown, $options = []);
layer_name is typically a filename without directory and extension or table name.
- CopyLayer
- GetLayerByIndex
-
for $i (0..$datasource->GetLayerCount-1) { $layer = $datasource->GetLayerByIndex($i); }
- GetLayerByName
-
$layer = $datasource->GetLayerByName('layer_name');
layer_name is typically a filename without directory and extension or table name.
- TestCapability
- ExecuteSQL
-
$sql = "select * from spatial_data_table"; $layer = $datasource->ExecuteSQL($sql);
- ReleaseResultSet
-
$datasource->ReleaseResultSet($layer);
Do this for all layers that have been obtained with ExecuteSQL.
Geo::OGR::Layer
- GetRefCount
- SetSpatialFilter
- SetSpatialFilterRect
-
@rect = ($minX, $minY, $maxX, $maxY); $layer->SetSpatialFilterRect(@rect);
- GetSpatialFilter
- SetAttributeFilter
- ResetReading
-
$layer->ResetReading; while ($f = $layer->GetNextFeature()) { ... }
- GetName
- GetFeature
-
$feature = $layer->GetFeature($i);
- GetNextFeature
-
See above.
- SetNextByIndex
- SetFeature
- CreateFeature
-
$layer->CreateFeature($feature);
- DeleteFeature
- SyncToDisk
-
$layer->SyncToDisk;
- GetLayerDefn
-
$schema = $layer->GetLayerDefn();
- GetFeatureCount
-
$n = $layer->GetFeatureCount;
- GetExtent
- TestCapability
- CreateField
-
$column = new Geo::OGR::FieldDefn('my_field', $Geo::OGR::OFTInteger); # an example $layer->CreateField($column);
- StartTransaction
- CommitTransaction
- RollbackTransaction
- GetSpatialRef
- GetFeatureRead
Geo::OGR::Feature
$feature = new Geo::OGR::Feature($schema);
- GetDefnRef
- SetGeometry
-
$feature->SetGeometry($geom);
- SetGeometryDirectly
- GetGeometryRef
-
$geom = $feature->GetGeometryRef;
- Clone
- Equal
- GetFieldCount
- GetFieldDefnRef
- GetFieldAsString
-
$value = $feature->GetFieldAsString($field);
$field is either name or index.
- GetFieldAsInteger
-
$value = $feature->GetFieldAsInteger($field);
$field is either name or index.
- GetFieldAsDouble
-
$value = $feature->GetFieldAsDouble($field);
$field is either name or index
- IsFieldSet
- GetFieldIndex
- GetFID
- SetFID
- DumpReadable
- UnsetField
- SetField
-
$feature->SetField($field_name, $value);
or
$feature->SetField($field_number, $value);
- SetFrom
- GetStyleString
- SetStyleString
- GetFieldType
Geo::OGR::FeatureDefn (Schema)
- GetName
- GetFieldCount
-
$n = $schema->GetFieldCount()
- GetFieldDefn
-
$column = $schema->GetFieldDefn($i)
- GetFieldIndex
- AddFieldDefn
- GetGeomType
- SetGeomType
- GetReferenceCount
Geo::OGR::FieldDefn (Column)
$column = new Geo::OGR::FieldDefn('name', $Geo::OGR::OFTxxxx);
- GetName
- GetNameRef
- SetName
- GetType
- SetType
- GetJustify
- SetJustify
- GetWidth
- SetWidth
- GetPrecision
- SetPrecision
- GetFieldTypeName
Geo::OGR::Geometry
$type = $Geo::OGR::wkbPolygon; # an example
$geom = new Geo::OGR::Geometry($type);
- ExportToWkt
- ExportToWkb
- ExportToGML
- AddPoint
-
$geom->AddPoint($x, $y, $z = 0);
- AddGeometryDirectly
- AddGeometry
-
$geom->AddGeometry($another_geom);
For example add a LinearRing to a Polygon.
- Clone
- GetGeometryType
- GetGeometryName
- GetArea
- GetPointCount
-
$n = $geom->GetPointCount;
- GetX
-
$x = $geom->GetX($i);
- GetY
-
$y = $geom->GetY($i);
- GetZ
- GetGeometryCount
- SetPoint
- GetGeometryRef
- GetBoundary
- ConvexHull
- Buffer
- Intersection
- Union
- Difference
- SymmetricDifference
- Distance
- Empty
- Intersect
- Equal
- Disjoint
- Touches
- Crosses
- Within
- Contains
- Overlaps
- TransformTo
- Transform
-
$geom->Transform($transformation);
- GetSpatialReference
- AssignSpatialReference
- CloseRings
-
$geom->CloseRings;
Defined only for LinearRings.
- FlattenTo2D
- GetEnvelope
- Centroid
- WkbSize
- GetCoordinateDimension
- GetDimension
KNOWN BUGS
The reference counting scheme is not yet implemented. Make sure that parents are not deleted before their children! Use "my" a lot. Do not give undefined/uninitialized variables to methods.
SEE ALSO
perl(1), Geo::GDAL(3pm), Geo::GDAL::Const(3pm), Geo::OSR(3pm).
http://www.gdal.org
AUTHORS
The GDAL bindings team (in alphabetical order):
ari.jolma at tkk.fi cfis at interserv.com hobu at iastate.edu kruland at ku.edu warmerdam at pobox.com
COPYRIGHT AND LICENSE
Copyright 2005-2006 by the GDAL bindings team.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA.