std::string Envelope::toSqlString() { if (maxVals.srid.empty()) { return "ST_MakeEnvelope(" + toWkt() + ")"; } return "ST_MakeEnvelope(" + toWkt() + ", " + maxVals.srid + ")"; }
void QgsCoordinateReferenceSystem::debugPrint() { QgsDebugMsg( "***SpatialRefSystem***" ); QgsDebugMsg( "* Valid : " + ( mIsValidFlag ? QString( "true" ) : QString( "false" ) ) ); QgsDebugMsg( "* SrsId : " + QString::number( mSrsId ) ); QgsDebugMsg( "* Proj4 : " + toProj4() ); QgsDebugMsg( "* WKT : " + toWkt() ); QgsDebugMsg( "* Desc. : " + mDescription ); if ( mapUnits() == QGis::Meters ) { QgsDebugMsg( "* Units : meters" ); } else if ( mapUnits() == QGis::Feet ) { QgsDebugMsg( "* Units : feet" ); } else if ( mapUnits() == QGis::Degrees ) { QgsDebugMsg( "* Units : degrees" ); } }
shared_ptr<OGRSpatialReference> MapReprojector::createPlanarProjection(const OGREnvelope& env, Radians maxAngleError, Meters maxDistanceError, Meters testDistance, bool warnOnFail) { vector< shared_ptr<OGRSpatialReference> > projs = createAllPlanarProjections(env); QString deg = QChar(0x00B0); if (projs.size() == 0) { throw HootException("No candidate planar projections are available."); } vector<PlanarTestResult> testResults; vector<PlanarTestResult> passingResults; // if the envelope has zero size then return an orthographic projection. if (env.MaxX == env.MinX || env.MaxY == env.MinY) { return createOrthographic(env); } for (size_t i = 0; i < projs.size(); ++i) { PlanarTestResult tr; tr.i = i; if (_evaluateProjection(env, projs[i], testDistance, tr.distanceError, tr.angleError)) { // create a score that is weighted by the user's threshold values. tr.score = tr.distanceError / maxDistanceError + tr.angleError / maxAngleError; testResults.push_back(tr); if (tr.distanceError <= maxDistanceError && tr.angleError <= maxAngleError) { passingResults.push_back(tr); } } else { tr.distanceError = numeric_limits<double>::max(); tr.angleError = numeric_limits<double>::max(); tr.score = numeric_limits<double>::max(); testResults.push_back(tr); } //LOG_INFO("dis: " << tr.distanceError << "m angle: " << toDegrees(tr.angleError) << deg); } // |<--- 80 cols -->| QString errorMessage = "A projection within the specified error bounds could not be found. This is " "likely due to a very large bounds on the data. Please read " "'Hootenanny - Distance and Angle Errors Due to Reprojection' for more " "information. You may experience poor conflation performance as a result."; int bestIndex = -1; Log::WarningLevel level = Log::Debug; if (passingResults.size() > 0) { bestIndex = _findBestScore(passingResults); char* wkt = 0; projs[bestIndex]->exportToWkt(&wkt); LOG_DEBUG("Projection: " << wkt) OGRFree(wkt); } else if (warnOnFail == false) { level = Log::Warn; } else if (testResults.size() > 0) { LOG_WARN(errorMessage); bestIndex = _findBestScore(testResults); level = Log::Info; } LOG_LEVEL(level, "Planar projection has max distance error " << fixed << setprecision(2) << testResults[bestIndex].distanceError << "m " << "(" << testResults[bestIndex].distanceError / testDistance * 100.0 << "%) " << "and max angular error: " << toDegrees(testResults[bestIndex].angleError) << deg << " test distance: " << testDistance << "m"); LOG_LEVEL(level, "Projection: " << toWkt(projs[bestIndex])); if (bestIndex == -1) { throw HootException(errorMessage); } return projs[bestIndex]; }
std::string Point::toSqlString() { return toWkt(); }
std::string LineString::toSqlString() { return toWkt(); }