Exception: Proj4::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/proj4.rb

Overview

Base class for all Proj.4 exceptions. Subclasses with the name <errorname>Error are available for each exception.

Constant Summary collapse

ERRORS =

List of all Proj.4 errors. – (This list is created from the one in pj_strerrno.c in the Proj.4 distribution.) ++

%w{Unknown NoArgsInInitList NoOptionsInInitFile NoColonInInitString ProjectionNotNamed UnknownProjectionId EffectiveEccentricityEq1 UnknownUnitConversionId InvalidBooleanParamArgument UnknownEllipticalParameterName ReciprocalFlatteningIsZero RadiusReferenceLatitudeGt90 SquaredEccentricityLessThanZero MajorAxisOrRadiusIsZeroOrNotGiven LatitudeOrLongitudeExceededLimits InvalidXOrY ImproperlyFormedDMSValue NonConvergentInverseMeridinalDist NonConvergentInversePhi2 AcosOrAsinArgTooBig ToleranceCondition ConicLat1EqMinusLat2 Lat1GreaterThan90 Lat1IsZero LatTsGreater90 NoDistanceBetweenControlPoints ProjectionNotSelectedToBeRotated WSmallerZeroOrMSmallerZero LsatNotInRange PathNotInRange HSmallerZero KSmallerZero Lat0IsZeroOr90OrAlphaIsZero Lat1EqLat2OrLat1IsZeroOrLat2Is90 EllipticalUsageRequired InvalidUTMZoneNumber ArgsOutOfRangeForTchebyEval NoProjectionToBeRotated FailedToLoadNAD2783CorrectionFile BothNAndMMustBeSpecdAndGreaterZero NSmallerZeroOrNGreaterOneOrNotSpecified Lat1OrLat2NotSpecified AbsoluteLat1EqLat2 Lat0IsHalfPiFromMeanLat UnparseableCoordinateSystemDefinition GeocentricTransformationMissingZOrEllps UnknownPrimeMeridianConversionId}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.error(errnum) ⇒ Object

Return name of error with given number.

call-seq: error(errnum) -> String



38
39
40
# File 'lib/proj4.rb', line 38

def self.error(errnum)
  ERRORS[errnum.abs] || 'Unknown'
end

.listObject

Return list of all errors.

call-seq: list -> Array



30
31
32
# File 'lib/proj4.rb', line 30

def self.list
  ERRORS
end

.raise_error(errnum) ⇒ Object

Raise an error with error number errnum.

Raises:



43
44
45
# File 'lib/proj4.rb', line 43

def self.raise_error(errnum)
  raise eval("#{error(errnum.abs)}Error"), message(-(errnum.abs)), caller[0..-1]
end

Instance Method Details

#errnumObject

Return error number of this error.



48
49
50
# File 'lib/proj4.rb', line 48

def errnum
  self.class.errnum
end