Skip to content

Commit c1905c2

Browse files
committed
Revert "[grass] Use better approach to retrieve CRS information for mapsets"
This reverts commit 40e9710.
1 parent ee16c13 commit c1905c2

File tree

13 files changed

+5
-148
lines changed

13 files changed

+5
-148
lines changed

src/providers/grass/qgis.g.info.c

+2-25
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ int main( int argc, char **argv )
5353
info_opt->key = "info";
5454
info_opt->type = TYPE_STRING;
5555
info_opt->description = "info key";
56-
info_opt->options = "proj,wkt,srid,window,size,query,info,colors,stats";
56+
info_opt->options = "proj,window,size,query,info,colors,stats";
5757

5858
rast_opt = G_define_standard_option( G_OPT_R_INPUT );
5959
rast_opt->key = "rast";
@@ -107,6 +107,7 @@ int main( int argc, char **argv )
107107
if ( strcmp( "proj", info_opt->answer ) == 0 )
108108
{
109109
G_get_window( &window );
110+
/* code from g.proj */
110111
if ( window.proj != PROJECTION_XY )
111112
{
112113
struct Key_Value *projinfo, *projunits;
@@ -117,30 +118,6 @@ int main( int argc, char **argv )
117118
fprintf( stdout, "%s", wkt );
118119
}
119120
}
120-
else if ( strcmp( "wkt", info_opt->answer ) == 0 )
121-
{
122-
G_get_window( &window );
123-
if ( window.proj != PROJECTION_XY )
124-
{
125-
char *wkt = G_get_projwkt();
126-
if ( wkt )
127-
{
128-
fprintf( stdout, "%s", wkt );
129-
}
130-
}
131-
}
132-
else if ( strcmp( "srid", info_opt->answer ) == 0 )
133-
{
134-
G_get_window( &window );
135-
if ( window.proj != PROJECTION_XY )
136-
{
137-
char *srid = G_get_projsrid();
138-
if ( srid )
139-
{
140-
fprintf( stdout, "%s", srid );
141-
}
142-
}
143-
}
144121
else if ( strcmp( "window", info_opt->answer ) == 0 )
145122
{
146123
if ( rast_opt->answer )

src/providers/grass/qgsgrass.cpp

+3-38
Original file line numberDiff line numberDiff line change
@@ -2068,48 +2068,13 @@ QgsCoordinateReferenceSystem QgsGrass::crs( const QString &gisdbase, const QStri
20682068
QString &error )
20692069
{
20702070
QgsDebugMsgLevel( QStringLiteral( "gisdbase = %1 location = %2" ).arg( gisdbase, location ), 2 );
2071-
QgsCoordinateReferenceSystem crs;
2072-
2073-
// try getting SRID directly first
2074-
try
2075-
{
2076-
const QString srid = getInfo( QStringLiteral( "srid" ), gisdbase, location );
2077-
QgsDebugMsgLevel( QStringLiteral( "srid: %1" ).arg( srid ), 2 );
2078-
crs = QgsCoordinateReferenceSystem( srid );
2079-
if ( crs.isValid() )
2080-
return crs;
2081-
}
2082-
catch ( QgsGrass::Exception &e )
2083-
{
2084-
error = tr( "Cannot get SRID" ) + "\n" + e.what();
2085-
QgsDebugError( error );
2086-
}
2087-
2088-
// else try WKT
2071+
QgsCoordinateReferenceSystem crs = QgsCoordinateReferenceSystem();
20892072
try
20902073
{
2091-
const QString wkt = getInfo( QStringLiteral( "wkt" ), gisdbase, location );
2092-
QgsDebugMsgLevel( QStringLiteral( "wkt: %1" ).arg( wkt ), 2 );
2074+
QString wkt = getInfo( QStringLiteral( "proj" ), gisdbase, location );
2075+
QgsDebugMsgLevel( "wkt: " + wkt, 2 );
20932076
crs = QgsCoordinateReferenceSystem::fromWkt( wkt );
20942077
QgsDebugMsgLevel( "crs.toWkt: " + crs.toWkt(), 2 );
2095-
if ( crs.isValid() )
2096-
return crs;
2097-
}
2098-
catch ( QgsGrass::Exception &e )
2099-
{
2100-
error = tr( "Cannot get projection" ) + "\n" + e.what();
2101-
QgsDebugError( error );
2102-
}
2103-
2104-
//else try lossy old proj properties approach
2105-
try
2106-
{
2107-
const QString wktFromProjString = getInfo( QStringLiteral( "proj" ), gisdbase, location );
2108-
QgsDebugMsgLevel( QStringLiteral( "WKT from proj string: %1" ).arg( wktFromProjString ), 2 );
2109-
crs = QgsCoordinateReferenceSystem::fromWkt( wktFromProjString );
2110-
QgsDebugMsgLevel( "crs.toWkt: " + crs.toWkt(), 2 );
2111-
if ( crs.isValid() )
2112-
return crs;
21132078
}
21142079
catch ( QgsGrass::Exception &e )
21152080
{

tests/testdata/grass/webmerc/PERMANENT/DEFAULT_WIND

-18
This file was deleted.

tests/testdata/grass/webmerc/PERMANENT/PROJ_INFO

-12
This file was deleted.

tests/testdata/grass/webmerc/PERMANENT/PROJ_SRID

-1
This file was deleted.

tests/testdata/grass/webmerc/PERMANENT/PROJ_UNITS

-3
This file was deleted.

tests/testdata/grass/webmerc/PERMANENT/PROJ_WKT

-1
This file was deleted.

tests/testdata/grass/webmerc/PERMANENT/WIND

-18
This file was deleted.

tests/testdata/grass/webmerc/webmerc/WIND

-18
This file was deleted.
-47 Bytes
Binary file not shown.

tests/testdata/grass/webmerc/webmerc/vector/ff/dbln

Whitespace-only changes.

tests/testdata/grass/webmerc/webmerc/vector/ff/head

-10
This file was deleted.

tests/testdata/grass/webmerc/webmerc/vector/ff/hist

-4
This file was deleted.

0 commit comments

Comments
 (0)