readosm.h File Reference

Go to the source code of this file.

## Data Structures

struct | readosm_tag_struct
struct | readosm_node_struct
struct | readosm_way_struct
struct | readosm_member_struct
struct | readosm_relation_struct

## Macros

#define | READOSM_UNDEFINED -1234567890
| information is not available
#define | READOSM_MEMBER_NODE 7361
| MemberType: NODE.
#define | READOSM_MEMBER_WAY 6731
| MemberType: WAY.
#define | READOSM_MEMBER_RELATION 3671
| MemberType: RELATION.
#define | READOSM_OK 0
| No error, success.
#define | READOSM_INVALID_SUFFIX -1
| not .osm or .pbf suffix
#define | READOSM_FILE_NOT_FOUND -2
| .osm or .pbf file does not exist or is not accessible for reading
#define | READOSM_NULL_HANDLE -3
| Null OSM_handle argument.
#define | READOSM_INVALID_HANDLE -4
| Invalid OSM_handle argument.
#define | READOSM_INSUFFICIENT_MEMORY -5
| some kind of memory allocation failure
#define | READOSM_CREATE_XML_PARSER_ERROR -6
| cannot create the XML Parser
#define | READOSM_READ_ERROR -7
| read error
#define | READOSM_XML_ERROR -8
| XML parser error.
#define | READOSM_INVALID_PBF_HEADER -9
| invalid PBF header
#define | READOSM_UNZIP_ERROR -10
| unZip error
#define | READOSM_ABORT -11
| user-required parser abort

## Typedefs

typedef struct readosm_tag_struct | readosm_tag
| Typedef for TAG structure. More...
typedef struct readosm_node_struct | readosm_node
| Typedef for NODE structure. More...
typedef struct readosm_way_struct | readosm_way
| Typedef for WAY structure. More...
typedef struct readosm_member_struct | readosm_member
| Typedef for MEMBER structure. More...
typedef struct readosm_relation_struct | readosm_relation
| Typedef for RELATION structure. More...
typedef int(* | readosm_node_callback) (const void *user_data, const readosm_node *node)
| callback function handling NODE objects
typedef int(* | readosm_way_callback) (const void *user_data, const readosm_way *way)
| callback function handling WAY objects
typedef int(* | readosm_relation_callback) (const void *user_data, const readosm_relation *relation)
| callback function handling RELATION objects

## Functions

READOSM_DECLARE int | readosm_open (const char *path, const void **osm_handle)
| Open the .osm or .pbf file, preparing for future functions. More...
READOSM_DECLARE int | readosm_close (const void *osm_handle)
| Close the .osm or .pbf file and release any allocated resource. More...
READOSM_DECLARE int | readosm_parse (const void *osm_handle, const void *user_data, readosm_node_callback node_fnct, readosm_way_callback way_fnct, readosm_relation_callback relation_fnct)
| Close the .osm or .pbf file and release any allocated resource. More...
const READOSM_DECLARE char * | readosm_version (void)
| Return the current ReadOSM version. More...
const READOSM_DECLARE char * | readosm_expat_version (void)
| Return the current libexpat version used by ReadOSM. More...
const READOSM_DECLARE char * | readosm_zlib_version (void)
| Return the current zlib version used by ReadOSM. More...

## Detailed Description

Function declarations and constants for ReadOSM library

## Typedef Documentation

## readosm_member

typedef struct readosm_member_struct readosm_member

Typedef for MEMBER structure.

See also
  readosm_member_struct

## readosm_node

typedef struct readosm_node_struct readosm_node

Typedef for NODE structure.

See also
  readosm_node_struct

## readosm_relation

typedef struct readosm_relation_struct readosm_relation

Typedef for RELATION structure.

See also
  readosm_relation_struct

## readosm_tag

typedef struct readosm_tag_struct readosm_tag

Typedef for TAG structure.

See also
  readosm_tag_struct

## readosm_way

typedef struct readosm_way_struct readosm_way

Typedef for WAY structure.

See also
  readosm_way_struct

## Function Documentation

## readosm_close()

READOSM_DECLARE int readosm_close | ( | const void * | osm_handle | ) |

Close the .osm or .pbf file and release any allocated resource.

Parameters

  osm_handle | the handle previously returned by readosm_open()

Returns
  READOSM_OK will be returned on success, otherwise any appropriate error code on failure.

Note
  After calling readosm_close() any related resource will be released, and the handle will no longer be valid.

Examples
  test_osm1.c, test_osm2.c, and test_osm3.c.

## readosm_expat_version()

const READOSM_DECLARE char* readosm_expat_version | ( | void |  | ) |

Return the current libexpat version used by ReadOSM.

Returns
  a text string corresponding the current Expat version

## readosm_open()

READOSM_DECLARE int readosm_open | ( | const char * | path,
|  | const void ** | osm_handle
| ) |  |

Open the .osm or .pbf file, preparing for future functions.

Parameters

  path | full or relative pathname of the input file.
  osm_handle | an opaque reference (handle) to be used in each subsequent function (return value).

Returns
  READOSM_OK will be returned on success, otherwise any appropriate error code on failure.

Note
  You are expected to readosm_close() even on failure, so as to correctly release any dynamic memory allocation.

Examples
  test_osm1.c, test_osm2.c, and test_osm3.c.

## readosm_parse()

READOSM_DECLARE int readosm_parse | ( | const void * | osm_handle,
|  | const void * | user_data,
|  | readosm_node_callback | node_fnct,
|  | readosm_way_callback | way_fnct,
|  | readosm_relation_callback | relation_fnct
| ) |  |

Close the .osm or .pbf file and release any allocated resource.

Parameters

  osm_handle | the handle previously returned by readosm_open()
  user_data | pointer to some user-supplied data struct
  node_fnct | pointer to callback function intended to consume NODE objects (may be NULL if processing NODEs is not an interesting option)
  way_fnct | pointer to callback function intended to consume WAY objects (may be NULL if processing WAYs is not an interesting option)
  relation_fnct | pointer to callback function intended to consume RELATION objects (may be NULL if processing RELATIONs is not an interesting option)

Returns
  READOSM_OK will be returned on success, otherwise any appropriate error code on failure.

Note
  After calling readosm_close() any related resource will be released, and the handle will no longer be valid.

Examples
  test_osm1.c, test_osm2.c, and test_osm3.c.

## readosm_version()

const READOSM_DECLARE char* readosm_version | ( | void |  | ) |

Return the current ReadOSM version.

Returns
  a text string corresponding the current ReadOSM version

## readosm_zlib_version()

const READOSM_DECLARE char* readosm_zlib_version | ( | void |  | ) |

Return the current zlib version used by ReadOSM.

Returns
  a text string corresponding the current zlib version