ogrConstants
public class ogr extends java.lang.Object implements ogrConstants
In particular, it provides ogr.RegisterAll() and ogr.Open() methods.
ALTER__FLAG, ALTER_ALL_FLAG, ALTER_DEFAULT_FLAG, ALTER_NAME_FLAG, ALTER_NULLABLE_FLAG, ALTER_TYPE_FLAG, ALTER_UNIQUE_FLAG, ALTER_WIDTH_PRECISION_FLAG, F_VAL_ALL, F_VAL_ALLOW_NULL_WHEN_DEFAULT, F_VAL_GEOM_TYPE, F_VAL_NULL, F_VAL_WIDTH, NullFID, ODrCCreateDataSource, ODrCDeleteDataSource, ODsCCreateGeomFieldAfterCreateLayer, ODsCCreateLayer, ODsCCurveGeometries, ODsCDeleteLayer, ODsCEmulatedTransactions, ODsCMeasuredGeometries, ODsCRandomLayerRead, ODsCRandomLayerWrite, ODsCTransactions, OFSTBoolean, OFSTFloat32, OFSTInt16, OFSTJSON, OFSTNone, OFTBinary, OFTDate, OFTDateTime, OFTInteger, OFTInteger64, OFTInteger64List, OFTIntegerList, OFTReal, OFTRealList, OFTString, OFTStringList, OFTTime, OFTWideString, OFTWideStringList, OGRERR_CORRUPT_DATA, OGRERR_FAILURE, OGRERR_INVALID_HANDLE, OGRERR_NON_EXISTING_FEATURE, OGRERR_NONE, OGRERR_NOT_ENOUGH_DATA, OGRERR_NOT_ENOUGH_MEMORY, OGRERR_UNSUPPORTED_GEOMETRY_TYPE, OGRERR_UNSUPPORTED_OPERATION, OGRERR_UNSUPPORTED_SRS, OJLeft, OJRight, OJUndefined, OLCAlterFieldDefn, OLCCreateField, OLCCreateGeomField, OLCCurveGeometries, OLCDeleteFeature, OLCDeleteField, OLCFastFeatureCount, OLCFastGetExtent, OLCFastSetNextByIndex, OLCFastSpatialFilter, OLCIgnoreFields, OLCMeasuredGeometries, OLCRandomRead, OLCRandomWrite, OLCReorderFields, OLCSequentialWrite, OLCStringsAsUTF8, OLCTransactions, OLMD_FID64, wkb25Bit, wkb25DBit, wkbCircularString, wkbCircularStringM, wkbCircularStringZ, wkbCircularStringZM, wkbCompoundCurve, wkbCompoundCurveM, wkbCompoundCurveZ, wkbCompoundCurveZM, wkbCurve, wkbCurveM, wkbCurvePolygon, wkbCurvePolygonM, wkbCurvePolygonZ, wkbCurvePolygonZM, wkbCurveZ, wkbCurveZM, wkbGeometryCollection, wkbGeometryCollection25D, wkbGeometryCollectionM, wkbGeometryCollectionZM, wkbLinearRing, wkbLineString, wkbLineString25D, wkbLineStringM, wkbLineStringZM, wkbMultiCurve, wkbMultiCurveM, wkbMultiCurveZ, wkbMultiCurveZM, wkbMultiLineString, wkbMultiLineString25D, wkbMultiLineStringM, wkbMultiLineStringZM, wkbMultiPoint, wkbMultiPoint25D, wkbMultiPointM, wkbMultiPointZM, wkbMultiPolygon, wkbMultiPolygon25D, wkbMultiPolygonM, wkbMultiPolygonZM, wkbMultiSurface, wkbMultiSurfaceM, wkbMultiSurfaceZ, wkbMultiSurfaceZM, wkbNDR, wkbNone, wkbPoint, wkbPoint25D, wkbPointM, wkbPointZM, wkbPolygon, wkbPolygon25D, wkbPolygonM, wkbPolygonZM, wkbPolyhedralSurface, wkbPolyhedralSurfaceM, wkbPolyhedralSurfaceZ, wkbPolyhedralSurfaceZM, wkbSurface, wkbSurfaceM, wkbSurfaceZ, wkbSurfaceZM, wkbTIN, wkbTINM, wkbTINZ, wkbTINZM, wkbTriangle, wkbTriangleM, wkbTriangleZ, wkbTriangleZM, wkbUnknown, wkbXDR
Modifier and Type | Method | Description |
---|---|---|
static Geometry |
ApproximateArcAngles(double dfCenterX,
double dfCenterY,
double dfZ,
double dfPrimaryRadius,
double dfSecondaryRadius,
double dfRotation,
double dfStartAngle,
double dfEndAngle,
double dfMaxAngleStepSizeDegrees) |
Stroke arc to linestring.
|
static Geometry |
BuildPolygonFromEdges(Geometry hLineCollection) |
|
static Geometry |
BuildPolygonFromEdges(Geometry hLineCollection,
int bBestEffort) |
Build a ring from a bunch of arcs.
|
static Geometry |
BuildPolygonFromEdges(Geometry hLineCollection,
int bBestEffort,
int bAutoClose) |
Build a ring from a bunch of arcs.
|
static Geometry |
BuildPolygonFromEdges(Geometry lineCollection,
int bBestEffort,
int bAutoClose,
double dfTolerance) |
Build a ring from a bunch of arcs.
|
static Geometry |
CreateGeometryFromEsriJson(java.lang.String input_string) |
|
static Geometry |
CreateGeometryFromGML(java.lang.String gml) |
Create a new Geometry from a GML string.
|
static Geometry |
CreateGeometryFromJson(java.lang.String json) |
Create a new Geometry from a GeoJSON string.
|
static Geometry |
CreateGeometryFromWkb(byte[] wkb) |
Create a new Geometry from a well known binary (wkb) content.
|
static Geometry |
CreateGeometryFromWkb(byte[] wkb,
SpatialReference srs) |
Create a new Geometry from a well known binary (wkb) content.
|
static Geometry |
CreateGeometryFromWkt(java.lang.String wkt) |
Create a new Geometry from a well known text (wkt) string.
|
static Geometry |
CreateGeometryFromWkt(java.lang.String wkt,
SpatialReference srs) |
Create a new Geometry from a well known text (wkt) content.
|
static void |
DontUseExceptions() |
Use return code instead of exceptions.
|
static Geometry |
ForceTo(Geometry geom_in,
int eTargetType) |
|
static Geometry |
ForceTo(Geometry geom_in,
int eTargetType,
java.util.Vector options) |
|
static Geometry |
ForceToLineString(Geometry geom_in) |
|
static Geometry |
ForceToMultiLineString(Geometry geom) |
Convert to multilinestring.
|
static Geometry |
ForceToMultiPoint(Geometry geom) |
Convert to multipoint.
|
static Geometry |
ForceToMultiPolygon(Geometry geom) |
Convert to multipolygon.
|
static Geometry |
ForceToPolygon(Geometry geom) |
Convert to polygon.
|
static java.lang.String[] |
GeneralCmdLineProcessor(java.lang.String[] args) |
General utility option processing.
|
static java.lang.String[] |
GeneralCmdLineProcessor(java.lang.String[] args,
int options) |
General utility option processing.
|
static java.util.Vector |
GeneralCmdLineProcessor(java.util.Vector args) |
General utility option processing.
|
static java.util.Vector |
GeneralCmdLineProcessor(java.util.Vector args,
int options) |
General utility option processing.
|
static java.lang.String |
GeometryTypeToName(int eType) |
Fetch a human readable name corresponding to an OGRwkBGeometryType value.
|
static Driver |
GetDriver(int iDriver) |
Fetch the indicated driver.
|
static Driver |
GetDriverByName(java.lang.String name) |
Fetch the indicated driver.
|
static int |
GetDriverCount() |
Fetch the number of registered drivers.
|
static java.lang.String |
GetFieldSubTypeName(int type) |
|
static java.lang.String |
GetFieldTypeName(int type) |
Fetch human readable name for a field type.
|
static int |
GetNonLinearGeometriesEnabledFlag() |
|
static DataSource |
GetOpenDS(int iDS) |
Return the iDS th datasource opened.
|
static int |
GetOpenDSCount() |
Return the number of opened datasources.
|
static int |
GT_Flatten(int eType) |
|
static int |
GT_GetCollection(int eType) |
|
static int |
GT_GetCurve(int eType) |
|
static int |
GT_GetLinear(int eType) |
|
static int |
GT_HasM(int eType) |
|
static int |
GT_HasZ(int eType) |
|
static int |
GT_IsCurve(int arg0) |
|
static int |
GT_IsNonLinear(int arg0) |
|
static int |
GT_IsSubClassOf(int eType,
int eSuperType) |
|
static int |
GT_IsSurface(int arg0) |
|
static int |
GT_SetM(int eType) |
|
static int |
GT_SetModifier(int eType,
int bSetZ) |
|
static int |
GT_SetModifier(int eType,
int bSetZ,
int bSetM) |
|
static int |
GT_SetZ(int eType) |
|
static DataSource |
Open(java.lang.String filename) |
Open a file / data source with one of the registered drivers.
|
static DataSource |
Open(java.lang.String filename,
boolean update) |
Open a file / data source with one of the registered drivers.
|
static DataSource |
Open(java.lang.String filename,
int update) |
Open a file / data source with one of the registered drivers.
|
static DataSource |
OpenShared(java.lang.String filename) |
Open a file / data source with one of the registered drivers.
|
static DataSource |
OpenShared(java.lang.String filename,
int update) |
Open a file / data source with one of the registered drivers.
|
static void |
RegisterAll() |
Register all known configured OGR drivers.
|
static int |
SetGenerate_DB2_V72_BYTE_ORDER(int bGenerate_DB2_V72_BYTE_ORDER) |
Special entry point to enable the hack for generating DB2 V7.2 style WKB.
|
static void |
SetNonLinearGeometriesEnabledFlag(int bFlag) |
|
static void |
UseExceptions() |
Use exceptions instead of error return codes.
|
public static void UseExceptions()
This is the default behavior : methods that in C/C++ return an OGRErr return code would throw a RuntimeException() in case the code it is different from ogr.OGRERR_NONE. By calling this method, you can get back to that original state if DontUseExceptions() was called in-between. This will only apply to the org.gdal.ogr.* package.
public static void DontUseExceptions()
By default, methods that in C/C++ return an OGRErr return code would throw a RuntimeException() in case the code it is different from ogr.OGRERR_NONE. By calling this method, you can prevent the exception to be thrown and get the original error code (ogr.OGRERR_* codes) This will only apply to the org.gdal.ogr.* package.
public static Geometry CreateGeometryFromWkb(byte[] wkb, SpatialReference srs)
wkb
- the wkb contentsrs
- the srs to assign to the geometrypublic static Geometry CreateGeometryFromWkb(byte[] wkb)
wkb
- the wkb contentpublic static Geometry CreateGeometryFromWkt(java.lang.String wkt, SpatialReference srs)
wkt
- the wkt contentsrs
- the srs to assign to the geometrypublic static Geometry CreateGeometryFromWkt(java.lang.String wkt)
wkt
- the wkt contentpublic static Geometry CreateGeometryFromGML(java.lang.String gml)
gml
- the GML stringpublic static Geometry CreateGeometryFromJson(java.lang.String json)
json
- the GeoJSON stringpublic static Geometry CreateGeometryFromEsriJson(java.lang.String input_string)
public static Geometry BuildPolygonFromEdges(Geometry lineCollection, int bBestEffort, int bAutoClose, double dfTolerance)
lineCollection
- geometry of type OGRGeometryCollection (or OGRMultiLineString) containing the line string geometries to be built into rings.bBestEffort
- not yet implemented???.bAutoClose
- indicates if the ring should be close when first and
last points of the ring are the same.dfTolerance
- tolerance into which two arcs are considered
close enough to be joined.public static Geometry BuildPolygonFromEdges(Geometry hLineCollection, int bBestEffort, int bAutoClose)
Same as below with dfTolerance == 0.
BuildPolygonFromEdges(Geometry lineCollection, int bBestEffort, int bAutoClose, double dfTolerance)
public static Geometry BuildPolygonFromEdges(Geometry hLineCollection, int bBestEffort)
Same as below with bAutoClose == 0 and dfTolerance == 0.
BuildPolygonFromEdges(Geometry lineCollection, int bBestEffort, int bAutoClose, double dfTolerance)
public static Geometry ApproximateArcAngles(double dfCenterX, double dfCenterY, double dfZ, double dfPrimaryRadius, double dfSecondaryRadius, double dfRotation, double dfStartAngle, double dfEndAngle, double dfMaxAngleStepSizeDegrees)
Stroke an arc of a circle to a linestring based on a center point, radius, start angle and end angle, all angles in degrees.
dfCenterX
- center XdfCenterY
- center YdfZ
- center ZdfPrimaryRadius
- X radius of ellipse.dfSecondaryRadius
- Y radius of ellipse.dfRotation
- rotation of the ellipse clockwise.dfStartAngle
- angle to first point on arc (clockwise of X-positive)dfEndAngle
- angle to last point on arc (clockwise of X-positive)dfMaxAngleStepSizeDegrees
- the largest step in degrees along the arc.public static Geometry ForceToPolygon(Geometry geom)
Tries to force the provided geometry to be a polygon. Currently this just effects a change on multipolygons.
Note: contrary to the C/C++ method, a new object is returned.
geom
- the input geometrypublic static Geometry ForceToMultiPolygon(Geometry geom)
Tries to force the provided geometry to be a multipolygon. Currently this just effects a change on polygons.
Note: contrary to the C/C++ method, a new object is returned.
geom
- the input geometrypublic static Geometry ForceToMultiPoint(Geometry geom)
Tries to force the provided geometry to be a multipoint. Currently this just effects a change on points.
Note: contrary to the C/C++ method, a new object is returned.
geom
- the input geometrypublic static Geometry ForceToMultiLineString(Geometry geom)
Tries to force the provided geometry to be a multilinestring.
Note: contrary to the C/C++ method, a new object is returned.
geom
- the input geometrypublic static Geometry ForceTo(Geometry geom_in, int eTargetType, java.util.Vector options)
public static int GetDriverCount()
public static int GetOpenDSCount()
public static int SetGenerate_DB2_V72_BYTE_ORDER(int bGenerate_DB2_V72_BYTE_ORDER)
DB2 seems to have placed (and require) an extra 0x30 or'ed with the byte order in WKB. This entry point is used to turn on or off the generation of such WKB.
public static void RegisterAll()
This function will drive any of the following that are configured into OGR. Many others as well that haven't been updated in this documentation (see full list):
This function should generally be called once at the beginning of the application.
public static java.lang.String GeometryTypeToName(int eType)
eType
- the geometry type.public static java.lang.String GetFieldTypeName(int type)
type
- the field type to get name for.public static java.lang.String GetFieldSubTypeName(int type)
public static int GT_Flatten(int eType)
public static int GT_SetZ(int eType)
public static int GT_SetM(int eType)
public static int GT_SetModifier(int eType, int bSetZ, int bSetM)
public static int GT_SetModifier(int eType, int bSetZ)
public static int GT_HasZ(int eType)
public static int GT_HasM(int eType)
public static int GT_IsSubClassOf(int eType, int eSuperType)
public static int GT_IsCurve(int arg0)
public static int GT_IsSurface(int arg0)
public static int GT_IsNonLinear(int arg0)
public static int GT_GetCollection(int eType)
public static int GT_GetCurve(int eType)
public static int GT_GetLinear(int eType)
public static void SetNonLinearGeometriesEnabledFlag(int bFlag)
public static int GetNonLinearGeometriesEnabledFlag()
public static DataSource GetOpenDS(int iDS)
iDS
- the index of the dataset to return (between 0 and GetOpenDSCount() - 1)public static DataSource Open(java.lang.String filename, int update)
This method loops through all the drivers registered with the driver manager trying each until one succeeds with the given data source.
If this method fails, gdal.GetLastErrorMsg() can be used to check if there is an error message explaining why.
The returned dataset should be properly closed with the DataSource.delete() method.
Example:
DataSource ds = ogr.Open( "polygon.shp" ); if( ds == null ) { return; } ... use the data source ... ds.delete();
filename
- the name of the file, or data source to open.update
- 0 for read-only access (the default) or 1 for
read-write access.public static DataSource Open(java.lang.String filename)
Same as below with update == 0
Open(String filename, int update)
public static DataSource OpenShared(java.lang.String filename, int update)
This first try finding an existing open dataset matching exactly on the original datasource raw name used to open the datasource.
NOTE: It is an error, but currently we ignore the bUpdate, and return whatever is open even if it is read-only and the application requested update access.
Open(String filename, int update)
public static DataSource OpenShared(java.lang.String filename)
This first try finding an existing open dataset matching exactly on the original datasource raw name used to open the datasource.
NOTE: It is an error, but currently we ignore the bUpdate, and return whatever is open even if it is read-only and the application requested update access.
Open(String filename, int update)
public static Driver GetDriverByName(java.lang.String name)
name
- the driver namepublic static Driver GetDriver(int iDriver)
iDriver
- the driver index, from 0 to GetDriverCount()-1.public static java.util.Vector GeneralCmdLineProcessor(java.util.Vector args, int options)
Same as below but with arguments as a Vector of strings
GeneralCmdLineProcessor(String[] args, int options)
public static java.util.Vector GeneralCmdLineProcessor(java.util.Vector args)
Same as below but with arguments as a Vector of strings and options == 0
GeneralCmdLineProcessor(String[] args, int options)
public static java.lang.String[] GeneralCmdLineProcessor(java.lang.String[] args, int options)
This function is intended to provide a variety of generic commandline options for all OGR commandline utilities. It takes care of the following commandline options:
The typical usage looks something like the following. Note that the formats should be registered so that the --formats and --format options will work properly.
public static void main( Strings[] args ) { ogr.RegisterAll(); args = ogr.GeneralCmdLineProcessor( args, 0 ); }
args
- the argument list arrayoptions
- currently unusedpublic static java.lang.String[] GeneralCmdLineProcessor(java.lang.String[] args)
Same as below with options == 0
GeneralCmdLineProcessor(String[] args, int options)
public static DataSource Open(java.lang.String filename, boolean update)
Same as below with boolean value being transformed to 1 (for true) or 0 (for false)
Open(String filename, int update)