Skip to content

Commit e809124

Browse files
author
mhugent
committedApr 16, 2011
Raster reprojection in QGIS server
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15724 c8812cc2-4d05-0410-92ff-de0c093fc19c

File tree

2 files changed

+21
-36
lines changed

2 files changed

+21
-36
lines changed
 

‎src/mapserver/qgsconfigparser.cpp

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -122,41 +122,31 @@ void QgsConfigParser::appendExGeographicBoundingBox( QDomElement& layerElem,
122122
QStringList QgsConfigParser::createCRSListForLayer( QgsMapLayer* theMapLayer ) const
123123
{
124124
QStringList crsNumbers;
125-
QgsVectorLayer* theVectorLayer = dynamic_cast<QgsVectorLayer*>( theMapLayer );
126-
127-
if ( theVectorLayer ) //append the source SRS. In future, all systems supported by proj4 should be appended
125+
QString myDatabaseFileName = QgsApplication::srsDbFilePath();
126+
sqlite3 *myDatabase;
127+
const char *myTail;
128+
sqlite3_stmt *myPreparedStatement;
129+
int myResult;
130+
131+
//check the db is available
132+
myResult = sqlite3_open( myDatabaseFileName.toLocal8Bit().data(), &myDatabase );
133+
if ( myResult )
128134
{
129-
QString myDatabaseFileName = QgsApplication::srsDbFilePath();
130-
sqlite3 *myDatabase;
131-
const char *myTail;
132-
sqlite3_stmt *myPreparedStatement;
133-
int myResult;
134-
135-
//check the db is available
136-
myResult = sqlite3_open( myDatabaseFileName.toLocal8Bit().data(), &myDatabase );
137-
if ( myResult )
138-
{
139-
//if the database cannot be opened, add at least the epsg number of the source coordinate system
140-
crsNumbers.push_back( theMapLayer->crs().authid() );
141-
return crsNumbers;
142-
};
143-
QString mySql = "select upper(auth_name||':'||auth_id) from tbl_srs";
144-
myResult = sqlite3_prepare( myDatabase, mySql.toUtf8(), mySql.length(), &myPreparedStatement, &myTail );
145-
if ( myResult == SQLITE_OK )
135+
//if the database cannot be opened, add at least the epsg number of the source coordinate system
136+
crsNumbers.push_back( theMapLayer->crs().authid() );
137+
return crsNumbers;
138+
};
139+
QString mySql = "select upper(auth_name||':'||auth_id) from tbl_srs";
140+
myResult = sqlite3_prepare( myDatabase, mySql.toUtf8(), mySql.length(), &myPreparedStatement, &myTail );
141+
if ( myResult == SQLITE_OK )
142+
{
143+
while ( sqlite3_step( myPreparedStatement ) == SQLITE_ROW )
146144
{
147-
while ( sqlite3_step( myPreparedStatement ) == SQLITE_ROW )
148-
{
149-
crsNumbers.push_back( QString::fromUtf8(( char * )sqlite3_column_text( myPreparedStatement, 0 ) ) );
150-
}
145+
crsNumbers.push_back( QString::fromUtf8(( char * )sqlite3_column_text( myPreparedStatement, 0 ) ) );
151146
}
152-
sqlite3_finalize( myPreparedStatement );
153-
sqlite3_close( myDatabase );
154-
}
155-
else //rasters cannot be reprojected. Use the epsg number of the layers native CRS
156-
{
157-
crsNumbers.push_back( theMapLayer->crs().authid() );
158147
}
159-
return crsNumbers;
148+
sqlite3_finalize( myPreparedStatement );
149+
sqlite3_close( myDatabase );
160150
}
161151

162152
bool QgsConfigParser::exGeographicBoundingBox( const QDomElement& layerElement, QgsRectangle& rect ) const

‎src/mapserver/qgswmsserver.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,11 +1179,6 @@ QStringList QgsWMSServer::layerSet( const QStringList& layersList,
11791179
theMapLayer = layerList.at( listIndex );
11801180
if ( theMapLayer )
11811181
{
1182-
if ( theMapLayer->type() == QgsMapLayer::RasterLayer )
1183-
{
1184-
//set the sourceSRS to the same as the destSRS
1185-
theMapLayer->setCrs( destCRS );
1186-
}
11871182
layerKeys.push_front( theMapLayer->id() );
11881183
QgsMapLayerRegistry::instance()->addMapLayer( theMapLayer, false );
11891184
}

0 commit comments

Comments
 (0)
Please sign in to comment.