QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
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

◆ ExportType

Enumerator
Point 
Polyline 
Polygon 

Definition at line 85 of file qgsosmdatabase.h.

Constructor & Destructor Documentation

◆ QgsOSMDatabase()

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

Definition at line 22 of file qgsosmdatabase.cpp.

◆ ~QgsOSMDatabase()

QgsOSMDatabase::~QgsOSMDatabase ( )

Definition at line 34 of file qgsosmdatabase.cpp.

Member Function Documentation

◆ close()

bool QgsOSMDatabase::close ( )

Definition at line 77 of file qgsosmdatabase.cpp.

◆ countNodes()

int QgsOSMDatabase::countNodes ( ) const

Definition at line 116 of file qgsosmdatabase.cpp.

◆ countWays()

int QgsOSMDatabase::countWays ( ) const

Definition at line 121 of file qgsosmdatabase.cpp.

◆ createSpatialIndex()

bool QgsOSMDatabase::createSpatialIndex ( const QString tableName)
protected

Definition at line 365 of file qgsosmdatabase.cpp.

◆ createSpatialTable()

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

Definition at line 334 of file qgsosmdatabase.cpp.

◆ deleteStatement()

void QgsOSMDatabase::deleteStatement ( sqlite3_stmt *&  stmt)
protected
Note
not available in Python bindings

Definition at line 67 of file qgsosmdatabase.cpp.

◆ errorString()

QString QgsOSMDatabase::errorString ( ) const
inline

Definition at line 59 of file qgsosmdatabase.h.

◆ exportSpatiaLite()

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

Definition at line 293 of file qgsosmdatabase.cpp.

◆ exportSpatiaLiteNodes()

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

Definition at line 381 of file qgsosmdatabase.cpp.

◆ exportSpatiaLiteWays()

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

Definition at line 445 of file qgsosmdatabase.cpp.

◆ filename()

QString QgsOSMDatabase::filename ( ) const
inline

Definition at line 53 of file qgsosmdatabase.h.

◆ isOpen()

bool QgsOSMDatabase::isOpen ( ) const

Definition at line 40 of file qgsosmdatabase.cpp.

◆ listNodes()

QgsOSMNodeIterator QgsOSMDatabase::listNodes ( ) const
Note
not available in Python bindings

Definition at line 127 of file qgsosmdatabase.cpp.

◆ listWays()

QgsOSMWayIterator QgsOSMDatabase::listWays ( ) const
Note
not available in Python bindings

Definition at line 132 of file qgsosmdatabase.cpp.

◆ node()

QgsOSMNode QgsOSMDatabase::node ( QgsOSMId  id) const

Definition at line 138 of file qgsosmdatabase.cpp.

◆ open()

bool QgsOSMDatabase::open ( )

Definition at line 46 of file qgsosmdatabase.cpp.

◆ prepareStatements()

bool QgsOSMDatabase::prepareStatements ( )
protected

Definition at line 256 of file qgsosmdatabase.cpp.

◆ quotedIdentifier()

QString QgsOSMDatabase::quotedIdentifier ( QString  id)
protected

Definition at line 531 of file qgsosmdatabase.cpp.

◆ quotedValue()

QString QgsOSMDatabase::quotedValue ( QString  value)
protected

Definition at line 537 of file qgsosmdatabase.cpp.

◆ runCountStatement()

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

Definition at line 99 of file qgsosmdatabase.cpp.

◆ setFileName()

void QgsOSMDatabase::setFileName ( const QString dbFileName)
inline

Definition at line 52 of file qgsosmdatabase.h.

◆ tags()

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

Definition at line 159 of file qgsosmdatabase.cpp.

◆ usedTags()

QList< QgsOSMTagCountPair > QgsOSMDatabase::usedTags ( bool  ways) const
Note
available in Python bindings

Definition at line 179 of file qgsosmdatabase.cpp.

◆ way()

QgsOSMWay QgsOSMDatabase::way ( QgsOSMId  id) const

Definition at line 202 of file qgsosmdatabase.cpp.

◆ wayPoints()

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: