QGIS API Documentation  2.11.0-Master
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(), const QStringList &noNullTagKeys=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, const QStringList &notNullTagKeys=QStringList())
 
void exportSpatiaLiteWays (bool closed, const QString &tableName, const QStringList &tagKeys, const QStringList &notNullTagKeys=QStringList())
 
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

Enumerator
Point 
Polyline 
Polygon 

Definition at line 81 of file qgsosmdatabase.h.

Constructor & Destructor Documentation

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

Definition at line 22 of file qgsosmdatabase.cpp.

QgsOSMDatabase::~QgsOSMDatabase ( )

Definition at line 34 of file qgsosmdatabase.cpp.

Member Function Documentation

bool QgsOSMDatabase::close ( )

Definition at line 77 of file qgsosmdatabase.cpp.

int QgsOSMDatabase::countNodes ( ) const

Definition at line 116 of file qgsosmdatabase.cpp.

int QgsOSMDatabase::countWays ( ) const

Definition at line 121 of file qgsosmdatabase.cpp.

bool QgsOSMDatabase::createSpatialIndex ( const QString tableName)
protected

Definition at line 365 of file qgsosmdatabase.cpp.

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

Definition at line 334 of file qgsosmdatabase.cpp.

void QgsOSMDatabase::deleteStatement ( sqlite3_stmt *&  stmt)
protected

Definition at line 67 of file qgsosmdatabase.cpp.

QString QgsOSMDatabase::errorString ( ) const
inline

Definition at line 59 of file qgsosmdatabase.h.

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

Definition at line 293 of file qgsosmdatabase.cpp.

void QgsOSMDatabase::exportSpatiaLiteNodes ( const QString tableName,
const QStringList tagKeys,
const QStringList notNullTagKeys = QStringList() 
)
protected

Definition at line 381 of file qgsosmdatabase.cpp.

void QgsOSMDatabase::exportSpatiaLiteWays ( bool  closed,
const QString tableName,
const QStringList tagKeys,
const QStringList notNullTagKeys = QStringList() 
)
protected

Definition at line 445 of file qgsosmdatabase.cpp.

QString QgsOSMDatabase::filename ( ) const
inline

Definition at line 53 of file qgsosmdatabase.h.

bool QgsOSMDatabase::isOpen ( ) const

Definition at line 40 of file qgsosmdatabase.cpp.

QgsOSMNodeIterator QgsOSMDatabase::listNodes ( ) const

Definition at line 127 of file qgsosmdatabase.cpp.

QgsOSMWayIterator QgsOSMDatabase::listWays ( ) const

Definition at line 132 of file qgsosmdatabase.cpp.

QgsOSMNode QgsOSMDatabase::node ( QgsOSMId  id) const

Definition at line 138 of file qgsosmdatabase.cpp.

bool QgsOSMDatabase::open ( )

Definition at line 46 of file qgsosmdatabase.cpp.

bool QgsOSMDatabase::prepareStatements ( )
protected

Definition at line 256 of file qgsosmdatabase.cpp.

QString QgsOSMDatabase::quotedIdentifier ( QString  id)
protected

Definition at line 531 of file qgsosmdatabase.cpp.

QString QgsOSMDatabase::quotedValue ( QString  value)
protected

Definition at line 537 of file qgsosmdatabase.cpp.

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

Definition at line 99 of file qgsosmdatabase.cpp.

void QgsOSMDatabase::setFileName ( const QString dbFileName)
inline

Definition at line 52 of file qgsosmdatabase.h.

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

Definition at line 159 of file qgsosmdatabase.cpp.

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

Definition at line 179 of file qgsosmdatabase.cpp.

QgsOSMWay QgsOSMDatabase::way ( QgsOSMId  id) const

Definition at line 202 of file qgsosmdatabase.cpp.

QgsPolyline QgsOSMDatabase::wayPoints ( QgsOSMId  id) const

Definition at line 234 of file qgsosmdatabase.cpp.


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