QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules 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 ()
 
void setFileName (const QString &dbFileName)
 
QString filename () const
 
bool isOpen () const
 
bool open ()
 
bool close ()
 
QString errorString () const
 
int countNodes () const
 
int countWays () const
 
QgsOSMNodeIterator listNodes () const
 
QgsOSMWayIterator listWays () const
 
QgsOSMNode node (QgsOSMId id) const
 
QgsOSMWay way (QgsOSMId id) const
 
QgsOSMTags tags (bool way, QgsOSMId id) const
 
QList< QgsOSMTagCountPairusedTags (bool ways) const
 
QgsPolyline wayPoints (QgsOSMId id) const
 
bool exportSpatiaLite (ExportType type, const QString &tableName, const QStringList &tagKeys=QStringList())
 

Protected Member Functions

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

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.

Member Enumeration Documentation

Enumerator
Point 
Polyline 
Polygon 

Constructor & Destructor Documentation

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

Member Function Documentation

bool QgsOSMDatabase::close ( )
int QgsOSMDatabase::countNodes ( ) const
int QgsOSMDatabase::countWays ( ) const
bool QgsOSMDatabase::createSpatialIndex ( const QString &  tableName)
protected
bool QgsOSMDatabase::createSpatialTable ( const QString &  tableName,
const QString &  geometryType,
const QStringList &  tagKeys 
)
protected
void QgsOSMDatabase::deleteStatement ( sqlite3_stmt *&  stmt)
protected
QString QgsOSMDatabase::errorString ( ) const
inline
bool QgsOSMDatabase::exportSpatiaLite ( ExportType  type,
const QString &  tableName,
const QStringList &  tagKeys = QStringList() 
)
void QgsOSMDatabase::exportSpatiaLiteNodes ( const QString &  tableName,
const QStringList &  tagKeys 
)
protected
void QgsOSMDatabase::exportSpatiaLiteWays ( bool  closed,
const QString &  tableName,
const QStringList &  tagKeys 
)
protected
QString QgsOSMDatabase::filename ( ) const
inline
bool QgsOSMDatabase::isOpen ( ) const
QgsOSMNodeIterator QgsOSMDatabase::listNodes ( ) const
QgsOSMWayIterator QgsOSMDatabase::listWays ( ) const
QgsOSMNode QgsOSMDatabase::node ( QgsOSMId  id) const
bool QgsOSMDatabase::open ( )
bool QgsOSMDatabase::prepareStatements ( )
protected
QString QgsOSMDatabase::quotedIdentifier ( QString  id)
protected
QString QgsOSMDatabase::quotedValue ( QString  value)
protected
int QgsOSMDatabase::runCountStatement ( const char *  sql) const
protected
void QgsOSMDatabase::setFileName ( const QString &  dbFileName)
inline
QgsOSMTags QgsOSMDatabase::tags ( bool  way,
QgsOSMId  id 
) const
QList< QgsOSMTagCountPair > QgsOSMDatabase::usedTags ( bool  ways) const
QgsOSMWay QgsOSMDatabase::way ( QgsOSMId  id) const
QgsPolyline QgsOSMDatabase::wayPoints ( QgsOSMId  id) const

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