geo-utils

Geographic Utilities

  1. geo-utils
  2. Documentation
    1. Module geopoint
      1. Usage
      2. Argument Conventions
      3. make-geopoint
      4. geopoint?
      5. check-geopoint
      6. error-geopoint
      7. geopoint-latitude
      8. geopoint-longitude
      9. geopoint-strictly-above?
      10. geopoint-above?
      11. geopoint-strictly-below?
      12. geopoint-below?
      13. geopoint-strictly-left?
      14. geopoint-left?
      15. geopoint-strictly-right?
      16. geopoint-right?
      17. geopoint=
      18. geopoint<
      19. geopoint>
      20. geopoint<=
      21. geopoint>=
    2. Module geobox
      1. Usage
      2. Argument Conventions
      3. make-geobox
      4. geobox?
      5. check-geobox
      6. error-geobox
      7. geobox-minimum
      8. geobox-maximum
      9. geobox=
      10. geobox<
      11. geobox>
      12. geobox<=
      13. geobox>=
      14. geopoint-within-box?
    3. Module geopolygon
      1. Usage
      2. Argument Conventions
      3. make-geopolygon
      4. geopolygon?
      5. check-geopolygon
      6. error-geopolygon
      7. geopolygon->list
      8. list->geopolygon
      9. geopolygon
      10. geopolygon-closed?
      11. geopolygon-open?
      12. geopolygon-bounding-box
    4. Module geopoint-utils
      1. Usage
      2. in-closed-polygon?
      3. intersects?
      4. pythagorean-distance
      5. pythagorean-distance*
      6. spherical-surface-distance
      7. great-circle-distance
      8. great-circle-distance-radians
      9. approximate-ellipsoid-distance
      10. great-circle-azimuth
      11. great-circle-position
    5. Module geo-utils
      1. Usage
      2. pythagorean-distance
      3. pythagorean-distance*
      4. spherical-surface-distance
      5. great-circle-distance
      6. great-circle-distance-radians
      7. approximate-ellipsoid-distance
      8. great-circle-azimuth
      9. great-circle-position
      10. intersects?-pnp
      11. intersects?-pip
    6. Module geo-dms
      1. Usage
      2. Argument Conventions
      3. degree-minute-second-text
      4. dms->degree
      5. degree->dms
      6. dms->string
      7. dms->string*
      8. string-dms->degree
      9. string->degree
      10. degree->string
    7. Module globe
      1. Usage
      2. make-globe
      3. globe?
      4. check-globe
      5. error-globe
      6. globe-radius-kilometers
      7. globe-flattening-factor
      8. spherical-surface-distance
      9. great-circle-distance
      10. great-circle-distance-radians
      11. approximate-ellipsoid-distance
      12. great-circle-azimuth
      13. great-circle-position
    8. Module earth
      1. Usage
      2. *earth-flattening*
      3. *earth-radius-miles*
      4. *earth-radius-kilometers*
      5. make-earth
  3. Bugs & Limitations
  4. Notes
  5. Requirements
  6. Author
  7. Repository
  8. Version history
  9. License

Documentation

API for constructing and manipulating geographic data.

Module geopoint

Usage

(import geopoint)

Argument Conventions

GP
geopoint.
LAT
latitude real.
LON
longitude real.

make-geopoint

[procedure] (make-geopoint LAT LON) -> geopoint

geopoint?

[procedure] (geopoint? OBJ) --> boolean

check-geopoint

[procedure] (check-geopoint LOC OBJ [VARNAM]) -> geopoint

error-geopoint

[procedure] (error-geopoint LOC OBJ [VARNAM])

geopoint-latitude

[procedure] (geopoint-latitude GP) -> real

geopoint-longitude

[procedure] (geopoint-longitude GP) -> real

geopoint-strictly-above?

[procedure] (geopoint-strictly-above? GP1 GP2) --> boolean

geopoint-above?

[procedure] (geopoint-above? GP1 GP2) --> boolean

geopoint-strictly-below?

[procedure] (geopoint-strictly-below? GP1 GP2) --> boolean

geopoint-below?

[procedure] (geopoint-below? GP1 GP2) --> boolean

geopoint-strictly-left?

[procedure] (geopoint-strictly-left? GP1 GP2) --> boolean

geopoint-left?

[procedure] (geopoint-left? GP1 GP2) --> boolean

geopoint-strictly-right?

[procedure] (geopoint-strictly-right? GP1 GP2) --> boolean

geopoint-right?

[procedure] (geopoint-right? GP1 GP2) --> boolean

geopoint=

[procedure] (geopoint= GP1 GP2) --> boolean

geopoint<

[procedure] (geopoint< GP1 GP2) --> boolean

geopoint>

[procedure] (geopoint> GP1 GP2) --> boolean

geopoint<=

[procedure] (geopoint<= GP1 GP2) --> boolean

geopoint>=

[procedure] (geopoint>= GP1 GP2) --> boolean

Module geobox

Usage

(import geobox)

Argument Conventions

GB
geobox.

make-geobox

[procedure] (make-geobox GP-MIN GP-MAX) -> geobox

geobox?

[procedure] (geobox? OBJ) --> boolean

check-geobox

[procedure] (check-geobox LOC OBJ [VARNAM]) -> geobox

error-geobox

[procedure] (error-geobox LOC OBJ [VARNAM])

geobox-minimum

[procedure] (geobox-minimum GB) -> geopoint

geobox-maximum

[procedure] (geobox-maximum GB) -> geopoint

geobox=

[procedure] (geobox= GB1 GB2) --> boolean

geobox<

[procedure] (geobox< GB1 GB2) --> boolean

geobox>

[procedure] (geobox> GB1 GB2) --> boolean

geobox<=

[procedure] (geobox<= GB1 GB2) --> boolean

geobox>=

[procedure] (geobox>= GB1 GB2) --> boolean

geopoint-within-box?

[procedure] (geopoint-within-box? GP GB) --> boolean

Module geopolygon

Usage

(import geopolygon)

Argument Conventions

GPOLY
geopolygon.

make-geopolygon

[procedure] (make-geopolygon GPS) -> geopolygon
GPS
(or (list-of geopoint) (vector-of geopoint))

geopolygon?

[procedure] (geopolygon? OBJ) --> boolean

check-geopolygon

[procedure] (check-geopolygon LOC OBJ [VARNAM]) -> geopolygon

error-geopolygon

[procedure] (error-geopolygon LOC OBJ [VARNAM])

geopolygon->list

[procedure] (geopolygon->list GPOLY) -> (list-of geopoint)

list->geopolygon

[procedure] (list->geopolygon GPS) -> geopolygon
GPS
(list-of geopoint)

geopolygon

[procedure] (geopolygon GP...) -> geopolygon

geopolygon-closed?

[procedure] (geopolygon-closed? GPOLY) --> boolean

Polygon has the same initial and final geopoint.

geopolygon-open?

[procedure] (geopolygon-open? GPOLY) --> boolean

Polygon does not have the same initial and final geopoint.

geopolygon-bounding-box

[procedure] (geopolygon-bounding-box GPOLY) -> geobox

Module geopoint-utils

Usage

(import geopoint-utils)

in-closed-polygon?

[procedure] (in-closed-polygon? GP GPOLY [INTERSECTS? intersects?-pnp]) --> boolean

Is the (: GP geopoint) in the (: GPOLY (or (vector-of geopoint) (list-of geopoint)))?

INTERSECTS? is a (procedure ((: PI geopoint) (: PJ geopoint) (: LAT real) (: LON real)) --> boolean) testing for ray intersection.

Treats an open geopolygon as closed.

intersects?

[procedure] (intersects? PT PI PJ) --> boolean

Does the point PT intersect the line PI - PJ?

PT
geopoint ; point to test
PI
geopoint ; line end i
PJ
geopoint ; line end j

pythagorean-distance

[procedure] (pythagorean-distance GP1 GP2) -> real

pythagorean-distance*

[procedure] (pythagorean-distance* GP1 GP2) -> real

spherical-surface-distance

[procedure] (spherical-surface-distance GP1 GP2 (R EARTH-RADIUS-KILOMETERS)) -> real

great-circle-distance

[procedure] (great-circle-distance GP1 GP2 (R EARTH-RADIUS-KILOMETERS)) -> real

great-circle-distance-radians

[procedure] (great-circle-distance-radians GP1 GP2 (R EARTH-RADIUS-KILOMETERS)) -> real

approximate-ellipsoid-distance

[procedure] (approximate-ellipsoid-distance GP1 GP2 (R EARTH-RADIUS-KILOMETERS) (F EARTH-FLATTENING)) -> real

great-circle-azimuth

[procedure] (great-circle-azimuth GP1 GP2 [PREC 5]) -> real

great-circle-position

[procedure] (great-circle-position GP DIS AZI (R EARTH-RADIUS-KILOMETERS)) -> (values latitude longitude)

Module geo-utils

Usage

(import geo-utils)

pythagorean-distance

[procedure] (pythagorean-distance LAT1 LON1 LAT2 LON2) -> real

pythagorean-distance*

[procedure] (pythagorean-distance* LAT1 LON1 LAT2 LON2) -> real

spherical-surface-distance

[procedure] (spherical-surface-distance LAT1 LON1 LAT2 LON2 (R EARTH-RADIUS-KILOMETERS)) -> real

great-circle-distance

[procedure] (great-circle-distance LAT1 LON1 LAT2 LON2 (R EARTH-RADIUS-KILOMETERS)) -> real

great-circle-distance-radians

[procedure] (great-circle-distance-radians LAT1 LON1 LAT2 LON2 (R EARTH-RADIUS-KILOMETERS)) -> real

approximate-ellipsoid-distance

[procedure] (approximate-ellipsoid-distance LAT1 LON1 LAT2 LON2 (R EARTH-RADIUS-KILOMETERS) (F EARTH-FLATTENING)) -> real

great-circle-azimuth

[procedure] (great-circle-azimuth LAT1 LON1 LAT2 LON2 [PREC 5]) -> real

great-circle-position

[procedure] (great-circle-position LAT LON DIS AZI (R EARTH-RADIUS-KILOMETERS)) -> (values latitude longitude)

intersects?-pnp

[procedure] (intersects?-pnp LATI LONI LATJ LONJ LAT LON) --> boolean

intersects?-pip

[procedure] (intersects?-pip LATI LONI LATJ LONJ LAT LON) --> boolean

Module geo-dms

Usage

(import geo-dms)

Argument Conventions

D
degrees real.
M
minutes real, optional in string form.
S
seconds real, optional in string form.
DEG
degreesreal.
LAT?
latitude? boolean.
PAD
padding between elements string.
LEADING-DIR?
compass direction is prefix?

degree-minute-second-text

[procedure] (degree-minute-second-text [DMS-TEXT]) -> (list-of string)

DMS-TEXT is a 3 element list of string of the form (<degrees suffix> <minutes suffix> <seconds suffix>).

dms->degree

[procedure] (dms->degree D M S) -> real

degree->dms

[procedure] (degree->dms DEG) -> (values D M S)

Returns the degree+minutes+seconds for the degrees DEG.

dms->string

[procedure] (dms->string D M S [LAT? [LEADING-DIR? [PAD ""]]]) -> string

Example: 122°45'10"W

dms->string*

[procedure] (dms->string* D M S [PAD ""]) -> string

Example: 122°45'10"

string-dms->degree

string->degree

[procedure] (string-dms->degree STR [LAT?]) -> real
[procedure] (string->degree STR [LAT?]) -> real

Returns the degrees for string form of dms STR.

degree->string

[procedure] (degree->string DEG [LAT? [LEADING-DIR? [PAD ""]]]) -> string

Returns the dms-string for the degrees DEG.

Module globe

Usage

(import geo-globe)

make-globe

[procedure] (make-globe RADIUS FLATTENING) -> globe

globe?

[procedure] (globe? OBJ) --> boolean

check-globe

[procedure] (check-globe LOC OBJ [VARNAM]) -> globe

error-globe

[procedure] (error-globe LOC OBJ [VARNAM])

globe-radius-kilometers

[procedure] (globe-radius-kilometers GLOBE) -> number

globe-flattening-factor

[procedure] (globe-flattening-factor GLOBE) -> number

spherical-surface-distance

[procedure] (spherical-surface-distance GLOBE GP1 GP2) -> number

great-circle-distance

[procedure] (great-circle-distance GLOBE GP1 GP2) -> number

great-circle-distance-radians

[procedure] (great-circle-distance-radians GLOBE GP1 GP2) -> number

approximate-ellipsoid-distance

[procedure] (approximate-ellipsoid-distance GLOBE GP1 GP2) -> number

great-circle-azimuth

[procedure] (great-circle-azimuth GP1 GP2 [PRECISION 5]) -> number

great-circle-position

[procedure] (great-circle-position GLOBE GP DISTANCE AZIMUTH) -> geopoint

Module earth

Usage

(import geo-earth)

*earth-flattening*

<variable>*earth-flattening* -> real</variable>

*earth-radius-miles*

<variable>*earth-radius-miles* -> real</variable>

*earth-radius-kilometers*

<variable>*earth-radius-kilometers* -> real</variable>

make-earth

[procedure] (make-earth) -> globe

Bugs & Limitations

Notes

Requirements

mathh srfi-1 vector-lib check-errors

Author

Kon Lovett

Repository

This egg is hosted on the CHICKEN Subversion repository:

https://anonymous@code.call-cc.org/svn/chicken-eggs/release/5/geo-utils

If you want to check out the source code repository of this egg and you are not familiar with Subversion, see this page.

Version history

1.1.0
.
1.0.7
Degree seconds are float.
1.0.6
.
1.0.5
.
1.0.4
Allow (or integer ratnum float) as real; was float only.
1.0.3
.
1.0.2
.
1.0.1
.
1.0.0
CHICKEN 5 release.
0.5.0
Add earth.
0.4.0
SI default. Add globe.
0.3.2
Uses numbers.
0.3.1
Uses test.
0.3.0
.
0.2.0
.
0.1.1
.
0.1.0
Hello

License

Copyright (C) 2017-2022 Kon Lovett. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.