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



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

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

.listObject

Return list of all errors.

call-seq: list -> Array



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

def self.list
  ERRORS
end

.raise_error(errnum) ⇒ Object

Raise an error with error number errnum.

Raises:



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

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.



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

def errnum
  self.class.errnum
end