FortranGIS
Version2.5
|
Fortran 2003 interface to the readosm https://www.gaia-gis.it/fossil/readosm/index library. More...
Data Types | |
interface | append |
Quick method to append an element to the array. More... | |
type | arrayof_readosm_node_f |
Derived type defining a dynamically extensible array of TYPE(readosm_node_f) elements. More... | |
type | arrayof_readosm_relation_f |
Derived type defining a dynamically extensible array of TYPE(readosm_relation_f) elements. More... | |
type | arrayof_readosm_way_f |
Derived type defining a dynamically extensible array of TYPE(readosm_way_f) elements. More... | |
interface | delete |
Destructor for finalizing an array object. More... | |
interface | insert |
Method for inserting elements of the array at a desired position. More... | |
interface | packarray |
Method for packing the array object reducing at a minimum the memory occupation, without destroying its contents. More... | |
interface | readosm_close |
Close the .osm or .pbf file and release any allocated resource. More... | |
type | readosm_full_f |
Derived type for performing a prepackaged full parsing of an osm file. More... | |
type | readosm_member |
Object describing a RELATION-MEMBER structure. More... | |
type | readosm_member_f |
A more Fortran-friendly object describing a RELATION-MEMEBER structure. More... | |
type | readosm_node |
Object describing a NODE structure. More... | |
type | readosm_node_f |
A more Fortran-friendly object describing a NODE structure. More... | |
interface | readosm_open |
Open the .osm or .pbf file, preparing for future functions. More... | |
interface | readosm_parse |
Parse the corresponding file calling the selected callbacks for every entity encountered. More... | |
type | readosm_relation |
Object describing a RELATION structure. More... | |
type | readosm_relation_f |
A more Fortran-friendly object describing a RELATION structure. More... | |
type | readosm_tag |
Object describing a TAG structure. More... | |
type | readosm_tag_f |
A more Fortran-friendly object describing a TAG structure. More... | |
type | readosm_way |
Object describing a WAY structure. More... | |
type | readosm_way_f |
A more Fortran-friendly object describing a WAY structure. More... | |
interface | remove |
Method for removing elements of the array at a desired position. More... | |
Functions/Subroutines | |
integer(kind=c_int) function | readosm_parse_f (osm_handle, user_data, node_fnct, way_fnct, relation_fnct) |
Parse the corresponding file calling the selected callbacks for every entity encountered. More... | |
integer function | readosm_parse_full_f (osm_handle, fulldata) |
Simplified parsing method for quickly retrieving all the information from a osm file. More... | |
integer(kind=c_int) function | readosm_full_node (user_data, node) |
Predefined callback for parsing nodes. More... | |
integer(kind=c_int) function | readosm_full_way (user_data, way) |
Predefined callback for parsing ways. More... | |
integer(kind=c_int) function | readosm_full_relation (user_data, relation) |
Predefined callback for parsing relations. More... | |
Variables | |
integer, parameter | readosm_undefined = -1234567890 |
information is not available More... | |
integer, parameter | readosm_member_node = 7361 |
MemberType: NODE. More... | |
integer, parameter | readosm_member_way = 6731 |
MemberType: WAY. More... | |
integer, parameter | readosm_member_relation = 3671 |
MemberType: RELATION. More... | |
integer, parameter | readosm_ok = 0 |
No error, success. More... | |
integer, parameter | readosm_invalid_suffix = -1 |
not .osm or .pbf suffix More... | |
integer, parameter | readosm_file_not_found = -2 |
.osm or .pbf file does not exist or is not accessible for reading More... | |
integer, parameter | readosm_null_handle = -3 |
Null OSM_handle argument. More... | |
integer, parameter | readosm_invalid_handle = -4 |
Invalid OSM_handle argument. More... | |
integer, parameter | readosm_insufficient_memory = -5 |
some kind of memory allocation failure More... | |
integer, parameter | readosm_create_xml_parser_error = -6 |
cannot create the XML Parser More... | |
integer, parameter | readosm_read_error = -7 |
read error More... | |
integer, parameter | readosm_xml_error = -8 |
XML parser error. More... | |
integer, parameter | readosm_invalid_pbf_header = -9 |
invalid PBF header More... | |
integer, parameter | readosm_unzip_error = -10 |
unZip error More... | |
integer, parameter | readosm_abort = -11 |
user-required parser abort More... | |
Fortran 2003 interface to the readosm https://www.gaia-gis.it/fossil/readosm/index library.
ReadOSM is an open source library which is able to extract valid data from within an Open Street Map input file. It can read files in the .osm and .osm.pbf formats. ReadOSM is developed and maintained by Alessandro Furieri. This module defines an API which reflects the original readosm C API, plus some additional objects and methods to simplify the use from Fortran.
The reading of the file is callback-based, i.e. a user-defined function is called whenever a node, way or relation is encounterd in the file; the callback functions receive a copy of the entity read from the file in the form of a C-interoperable derived type which matches exactly the structures defined in the original readosm C library. The derived types can be converted on the fly to a more Fortran-friendly version, where pointers are replaced with Fortran arrays where possible. It is up to the callbacks to do something useful with the data received.
For an example of application of the readosm module, please refer to the following test program, which parses an osm file and dumps some information about it: