- Main Page
- Classes
- Files
- Directories
- Related Pages

# OGR Simple Feature Library

The OGR Simple Features Library is a C++ open source library (and commandline tools) providing read (and sometimes write) access to a variety of vector file formats including ESRI Shapefiles, S-57, SDTS, PostGIS, Oracle Spatial, and Mapinfo mid/mif and TAB formats.

OGR is a part of the GDAL library.

## Resources

- OGR Supported Formats

- OGR Utility Programs

- OGR Class Documentation

- OGR C++ API Read/Write Tutorial

- ogr_api.h: OGR C API

- OGR Projections Tutorial

- OGR Architecture

- OGR SQL

- OGR - Feature Style Specification

- SFC (OLE DB client side API) Tutorial

- Adam's 2.5 D Simple Features Proposal (OGC 99-402r2)

- Adam's SRS WKT Clarification Proposal in html or doc format.

## Download

### Ready to Use Executables

The best way to get OGR utilities in ready-to-use form is to download the latest FWTools kit for your platform. While large, these include builds of the OGR utilities with lots of optional components built-in. Once downloaded follow the included instructions to setup your path and other environment variables correctly, and then you can use the various OGR utilities from the command line. The kits also include OpenEV, a viewer that will display OGR supported vector files.

### Source

The source code for this effort is intended to be available as OpenSource using an X Consortium style license. The OGR library is currently a loosely coupled subcomponent of the GDAL library, so you get all of GDAL for the price of OGR, though you can build and use just the OGR components. See the GDAL page for the most recently released source including nightly CVS snapshots.

## Bug Reporting

OGR bugs can be entered, and can be listed using BugZilla.

## Mailing List

The gdal-dev@lists.maptools.org mailing list can be used for discussion of development and user issues related to OGR and related technologies. Subscriptions can be done, and archives reviewed on the web.

## Alternative Bindings for the OGR API

In addition to the C++ API primarily addressed in the online documentation, there is also a slightly less complete C API implemented on top of the C++ API, and access available from Python.

The C API is primarily intended to provide a less fragile API since slight changes in the C++ API (such as const correctness changes) can cause changes in method and class signatures that prevent use of new DLLs with older clients. The C API is also generally easy to call from other languages which allow call out to DLLs functions, such as Visual Basic, or Delphi. The API can be explored in the ogr_api.h include file. The gdal/ogr/ogr_capi_test.c is a small sample program demonstrating use of the C API.

The Python API isn't really well documented at this time, but parallels the C/C++ APIs. The interface classes can be browsed in the pymod/ogr.py (simple features) and pymod/osr.py (coordinate systems) python modules. The pymod/samples/assemblepoly.py sample script is one demonstration of using the python API.

## OGR and OpenGIS Simple Features for OLE DB

With the support of SoftMap and Safe Software some associates and I have implemented an OLE DB provider on top of OGR, attempting to adhere to the OpenGIS Simple Features for COM specification to the extent possible. This implementation is not certified as compliant with the OpenGIS specification.

While OGR can be used via the OLE DB interface, it can also just be called directly as a C++ library. OGR attempts to provide an OpenGIS Simple Features inspired terminology and view of datasets even when used in this fashion. Note that there is no OpenGIS specification for a C or C++ interface.

OGR stands for "OGR"... its meaning is irrelevant today. The original name for the lib was "OpenGIS Simple Features Reference Implementation" and that's where OGR comes from. However, since OGR is not fully compliant with the Simple Feature specification and is not approved as a reference implementation of the spec the name was changed to "OGR Simple Features Library" ... and the only meaning of OGR in this name is historical. "OGR" is also the prefix used everywhere in the source of the library for class names, filenames, etc.

## Acknowledgements

I would like to thank the following individuals and organizations for their contributions.

- SoftMap for their funding for the implementation of most work so far.

- Safe Software for their funding for the client side classes as part of implementing a simple features reader for FME, and supporting implmentaton of the S-57, TIGER/Line, SDTS and NTF drivers.

- Ned Harding of SRC for funding the Oracle Spatial driver.

- Adam Gawne-Cain, and Martin Daly of Cadcorp whose groundbreaking SFCOM implementation made mine possible, and for answering so many of my annoying questions.

- Daniel Morissette for his key contributions to CPL library, and development of the Mapinfo TAB translator.

- Ken Shih for the vast bulk of the implementation of the OLE DB provider.

- Stephane Villeneuve for development of the Mapinfo MIF translator.

- Hartmut Kaiser of Deutsche PhoneSat AG for making me realize that ATL can be my friend.

Generated for GDAL by 1.5.1.