Skip to content
Permalink
Browse files

Raster reprojection in QGIS server

git-svn-id: http://svn.osgeo.org/qgis/trunk@15724 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Apr 16, 2011
1 parent b93e54e commit f8e10a33b961ef95a66cb9326341cdd6ec5be18c
Showing with 21 additions and 36 deletions.
  1. +21 −31 src/mapserver/qgsconfigparser.cpp
  2. +0 −5 src/mapserver/qgswmsserver.cpp
@@ -122,41 +122,31 @@ void QgsConfigParser::appendExGeographicBoundingBox( QDomElement& layerElem,
QStringList QgsConfigParser::createCRSListForLayer( QgsMapLayer* theMapLayer ) const
{
QStringList crsNumbers;
QgsVectorLayer* theVectorLayer = dynamic_cast<QgsVectorLayer*>( theMapLayer );

if ( theVectorLayer ) //append the source SRS. In future, all systems supported by proj4 should be appended
QString myDatabaseFileName = QgsApplication::srsDbFilePath();
sqlite3 *myDatabase;
const char *myTail;
sqlite3_stmt *myPreparedStatement;
int myResult;

//check the db is available
myResult = sqlite3_open( myDatabaseFileName.toLocal8Bit().data(), &myDatabase );
if ( myResult )
{
QString myDatabaseFileName = QgsApplication::srsDbFilePath();
sqlite3 *myDatabase;
const char *myTail;
sqlite3_stmt *myPreparedStatement;
int myResult;

//check the db is available
myResult = sqlite3_open( myDatabaseFileName.toLocal8Bit().data(), &myDatabase );
if ( myResult )
{
//if the database cannot be opened, add at least the epsg number of the source coordinate system
crsNumbers.push_back( theMapLayer->crs().authid() );
return crsNumbers;
};
QString mySql = "select upper(auth_name||':'||auth_id) from tbl_srs";
myResult = sqlite3_prepare( myDatabase, mySql.toUtf8(), mySql.length(), &myPreparedStatement, &myTail );
if ( myResult == SQLITE_OK )
//if the database cannot be opened, add at least the epsg number of the source coordinate system
crsNumbers.push_back( theMapLayer->crs().authid() );
return crsNumbers;
};
QString mySql = "select upper(auth_name||':'||auth_id) from tbl_srs";
myResult = sqlite3_prepare( myDatabase, mySql.toUtf8(), mySql.length(), &myPreparedStatement, &myTail );
if ( myResult == SQLITE_OK )
{
while ( sqlite3_step( myPreparedStatement ) == SQLITE_ROW )
{
while ( sqlite3_step( myPreparedStatement ) == SQLITE_ROW )
{
crsNumbers.push_back( QString::fromUtf8(( char * )sqlite3_column_text( myPreparedStatement, 0 ) ) );
}
crsNumbers.push_back( QString::fromUtf8(( char * )sqlite3_column_text( myPreparedStatement, 0 ) ) );
}
sqlite3_finalize( myPreparedStatement );
sqlite3_close( myDatabase );
}
else //rasters cannot be reprojected. Use the epsg number of the layers native CRS
{
crsNumbers.push_back( theMapLayer->crs().authid() );
}
return crsNumbers;
sqlite3_finalize( myPreparedStatement );
sqlite3_close( myDatabase );
}

bool QgsConfigParser::exGeographicBoundingBox( const QDomElement& layerElement, QgsRectangle& rect ) const
@@ -1179,11 +1179,6 @@ QStringList QgsWMSServer::layerSet( const QStringList& layersList,
theMapLayer = layerList.at( listIndex );
if ( theMapLayer )
{
if ( theMapLayer->type() == QgsMapLayer::RasterLayer )
{
//set the sourceSRS to the same as the destSRS
theMapLayer->setCrs( destCRS );
}
layerKeys.push_front( theMapLayer->id() );
QgsMapLayerRegistry::instance()->addMapLayer( theMapLayer, false );
}

0 comments on commit f8e10a3

Please sign in to comment.
You can’t perform that action at this time.