PRCoords for Racket
latlon
latlon-compare
latlon<?
latlon>?
9.3

PRCoords for Racket🔗ℹ

Mingye Wang

 (require prcoords) package: prcoords

A Typed Racket port of People’s Rectified Coordinates: the GCJ-02 and BD-09 obfuscations of Chinese map coordinates, along with the Caijun refinement for the inverses.

Coordinates are latlon structs holding Flonums in degrees. The transforms are wgs-gcj, gcj-wgs, gcj-bd, bd-gcj, wgs-bd and bd-wgs; each has a * variant that takes an explicit China check, and the -bored procedures run ten rounds of the Caijun fixed-point refinement.

struct

(struct latlon (lat lon)
    #:extra-constructor-name make-latlon)
  lat : Flonum
  lon : Flonum
A point in degrees.

procedure

(latlon-compare a b) → exact-integer?

  a : latlon
  b : latlon
Returns -1, 0 or 1 as a sorts before, equal to or after b, by latitude then longitude.

procedure

(latlon<? a b) → boolean?

  a : latlon
  b : latlon
True when a sorts before b.

procedure

(latlon>? a b) → boolean?

  a : latlon
  b : latlon
True when a sorts after b.