QGIS API Documentation  2.8.2-Wien
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | Public Member Functions | Protected Member Functions | List of all members
QgsOSMDatabase Class Reference

Class that encapsulates access to OpenStreetMap data stored in a database previously imported from XML file. More...

#include <qgsosmdatabase.h>

Public Types

enum  ExportType { Point, Polyline, Polygon }

Public Member Functions

 QgsOSMDatabase (const QString &dbFileName=QString())
 ~QgsOSMDatabase ()
bool close ()
int countNodes () const
int countWays () const
QString errorString () const
bool exportSpatiaLite (ExportType type, const QString &tableName, const QStringList &tagKeys=QStringList())
QString filename () const
bool isOpen () const
QgsOSMNodeIterator listNodes () const
QgsOSMWayIterator listWays () const
QgsOSMNode node (QgsOSMId id) const
bool open ()
void setFileName (const QString &dbFileName)
QgsOSMTags tags (bool way, QgsOSMId id) const
QList< QgsOSMTagCountPairusedTags (bool ways) const
QgsOSMWay way (QgsOSMId id) const
QgsPolyline wayPoints (QgsOSMId id) const

Protected Member Functions

bool createSpatialIndex (const QString &tableName)
bool createSpatialTable (const QString &tableName, const QString &geometryType, const QStringList &tagKeys)
void deleteStatement (sqlite3_stmt *&stmt)
void exportSpatiaLiteNodes (const QString &tableName, const QStringList &tagKeys)
void exportSpatiaLiteWays (bool closed, const QString &tableName, const QStringList &tagKeys)
bool prepareStatements ()
QString quotedIdentifier (QString id)
QString quotedValue (QString value)
int runCountStatement (const char *sql) const

Detailed Description

Class that encapsulates access to OpenStreetMap data stored in a database previously imported from XML file.

Internal database structure consists of the following tables:

The topology representation can be translated to simple features representation using exportSpatiaLite() method into SpatiaLite layers (tables). These can be easily used in QGIS like any other layers.

Definition at line 46 of file qgsosmdatabase.h.

Member Enumeration Documentation


Definition at line 81 of file qgsosmdatabase.h.

Constructor & Destructor Documentation

QgsOSMDatabase::QgsOSMDatabase ( const QString &  dbFileName = QString())

Definition at line 25 of file qgsosmdatabase.cpp.

QgsOSMDatabase::~QgsOSMDatabase ( )

Definition at line 38 of file qgsosmdatabase.cpp.

Member Function Documentation

bool QgsOSMDatabase::close ( )

Definition at line 84 of file qgsosmdatabase.cpp.

int QgsOSMDatabase::countNodes ( ) const

Definition at line 123 of file qgsosmdatabase.cpp.

int QgsOSMDatabase::countWays ( ) const

Definition at line 128 of file qgsosmdatabase.cpp.

bool QgsOSMDatabase::createSpatialIndex ( const QString &  tableName)

Definition at line 372 of file qgsosmdatabase.cpp.

bool QgsOSMDatabase::createSpatialTable ( const QString &  tableName,
const QString &  geometryType,
const QStringList &  tagKeys 

Definition at line 341 of file qgsosmdatabase.cpp.

void QgsOSMDatabase::deleteStatement ( sqlite3_stmt *&  stmt)

Definition at line 74 of file qgsosmdatabase.cpp.

QString QgsOSMDatabase::errorString ( ) const

Definition at line 59 of file qgsosmdatabase.h.

bool QgsOSMDatabase::exportSpatiaLite ( ExportType  type,
const QString &  tableName,
const QStringList &  tagKeys = QStringList() 

Definition at line 302 of file qgsosmdatabase.cpp.

void QgsOSMDatabase::exportSpatiaLiteNodes ( const QString &  tableName,
const QStringList &  tagKeys 

Definition at line 388 of file qgsosmdatabase.cpp.

void QgsOSMDatabase::exportSpatiaLiteWays ( bool  closed,
const QString &  tableName,
const QStringList &  tagKeys 

Definition at line 443 of file qgsosmdatabase.cpp.

QString QgsOSMDatabase::filename ( ) const

Definition at line 53 of file qgsosmdatabase.h.

bool QgsOSMDatabase::isOpen ( ) const

Definition at line 44 of file qgsosmdatabase.cpp.

QgsOSMNodeIterator QgsOSMDatabase::listNodes ( ) const

Definition at line 134 of file qgsosmdatabase.cpp.

QgsOSMWayIterator QgsOSMDatabase::listWays ( ) const

Definition at line 139 of file qgsosmdatabase.cpp.

QgsOSMNode QgsOSMDatabase::node ( QgsOSMId  id) const

Definition at line 145 of file qgsosmdatabase.cpp.

bool QgsOSMDatabase::open ( )

Definition at line 50 of file qgsosmdatabase.cpp.

bool QgsOSMDatabase::prepareStatements ( )

Definition at line 263 of file qgsosmdatabase.cpp.

QString QgsOSMDatabase::quotedIdentifier ( QString  id)

Definition at line 516 of file qgsosmdatabase.cpp.

QString QgsOSMDatabase::quotedValue ( QString  value)

Definition at line 522 of file qgsosmdatabase.cpp.

int QgsOSMDatabase::runCountStatement ( const char *  sql) const

Definition at line 106 of file qgsosmdatabase.cpp.

void QgsOSMDatabase::setFileName ( const QString &  dbFileName)

Definition at line 52 of file qgsosmdatabase.h.

QgsOSMTags QgsOSMDatabase::tags ( bool  way,
QgsOSMId  id 
) const

Definition at line 166 of file qgsosmdatabase.cpp.

QList< QgsOSMTagCountPair > QgsOSMDatabase::usedTags ( bool  ways) const

Definition at line 186 of file qgsosmdatabase.cpp.

QgsOSMWay QgsOSMDatabase::way ( QgsOSMId  id) const

Definition at line 209 of file qgsosmdatabase.cpp.

QgsPolyline QgsOSMDatabase::wayPoints ( QgsOSMId  id) const

Definition at line 241 of file qgsosmdatabase.cpp.

The documentation for this class was generated from the following files: