"GeoPosition" (Comparison Method)

Compare geographic positions based on geodesic distances.

Details

  • The "GeoPosition" comparison method considers two geodetic positions to be equivalent if the geodesic distance between them is within a given distance tolerance.
  • The distance tolerance should usually be set using the Tolerance option in AssessmentFunction. The default value of zero meters allows only machine precision differences. The tolerance should always be a Quantity with units of length.
  • The default distance function is GeoDistance, but any other distance metric can be specified for the comparison using the DistanceFunction option in AssessmentFunction.
  • When the answer key contains multiple possible positions that are within the tolerance range of an answer, the assessment is based on the closest answer key.
  • For convenience, vectors with two or three components are also accepted as input and treated as arguments to GeoPosition.

Examples

open allclose all

Basic Examples  (3)

Create an AssessmentFunction for GeoPosition comparison with a nonzero tolerance:

Answers within the tolerance range are marked as correct:

Use zero tolerance:

Even nearby locations are marked as incorrect:

Only locations with geo positions within machine precision level are accepted:

Define an assessment for a problem with multiple answers, each with a different score.

Try some answers:

Show detailed information about the answer, including the final score, which corresponds to the closest answer key within the tolerance:

Answers matching values with negative scores are marked as incorrect:

Generalizations & Extensions  (1)

Geographic entities are directly accepted as input:

Options  (2)

The Tolerance can be given as any quantity with units of length:

Use the TravelDistance instead of the GeoDistance to perform the comparison, including an Echo to see the travel distance:

Applications  (1)

Create a geographic AssessmentFunction including cities in the northeast United States:

Create a QuestionObject for the assessment function:

Properties & Relations  (2)

For convenience, vectors with two or three components are also accepted as input and treated as arguments to GeoPosition. Create an assessment function using three different list forms of geo locations:

See the standardized answer key:

The "GeoPosition" method can be inferred only if all values in the answer keys are GeoPosition objects:

Possible Issues  (1)

The tolerance must be a Quantity with units of length:

Use a valid tolerance: