geo-utils
Geographic Utilities
- geo-utils
- Documentation
- Module geopoint
- Usage
- Argument Conventions
- make-geopoint
- geopoint?
- check-geopoint
- error-geopoint
- geopoint-latitude
- geopoint-longitude
- geopoint-strictly-above?
- geopoint-above?
- geopoint-strictly-below?
- geopoint-below?
- geopoint-strictly-left?
- geopoint-left?
- geopoint-strictly-right?
- geopoint-right?
- geopoint=
- geopoint<
- geopoint>
- geopoint<=
- geopoint>=
- Module geobox
- Module geopolygon
- Module geopoint-utils
- Module geo-utils
- Module geo-dms
- Module globe
- Module earth
- Module geopoint
- Bugs & Limitations
- Notes
- Requirements
- Author
- Repository
- Version history
- 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) -> geopointgeopoint?
[procedure] (geopoint? OBJ) --> booleancheck-geopoint
[procedure] (check-geopoint LOC OBJ [VARNAM]) -> geopointerror-geopoint
[procedure] (error-geopoint LOC OBJ [VARNAM])geopoint-latitude
[procedure] (geopoint-latitude GP) -> realgeopoint-longitude
[procedure] (geopoint-longitude GP) -> realgeopoint-strictly-above?
[procedure] (geopoint-strictly-above? GP1 GP2) --> booleangeopoint-above?
[procedure] (geopoint-above? GP1 GP2) --> booleangeopoint-strictly-below?
[procedure] (geopoint-strictly-below? GP1 GP2) --> booleangeopoint-below?
[procedure] (geopoint-below? GP1 GP2) --> booleangeopoint-strictly-left?
[procedure] (geopoint-strictly-left? GP1 GP2) --> booleangeopoint-left?
[procedure] (geopoint-left? GP1 GP2) --> booleangeopoint-strictly-right?
[procedure] (geopoint-strictly-right? GP1 GP2) --> booleangeopoint-right?
[procedure] (geopoint-right? GP1 GP2) --> booleangeopoint=
[procedure] (geopoint= GP1 GP2) --> booleangeopoint<
[procedure] (geopoint< GP1 GP2) --> booleangeopoint>
[procedure] (geopoint> GP1 GP2) --> booleangeopoint<=
[procedure] (geopoint<= GP1 GP2) --> booleangeopoint>=
[procedure] (geopoint>= GP1 GP2) --> booleanModule geobox
Usage
(import geobox)
Argument Conventions
- GB
- geobox.
make-geobox
[procedure] (make-geobox GP-MIN GP-MAX) -> geoboxgeobox?
[procedure] (geobox? OBJ) --> booleancheck-geobox
[procedure] (check-geobox LOC OBJ [VARNAM]) -> geoboxerror-geobox
[procedure] (error-geobox LOC OBJ [VARNAM])geobox-minimum
[procedure] (geobox-minimum GB) -> geopointgeobox-maximum
[procedure] (geobox-maximum GB) -> geopointgeobox=
[procedure] (geobox= GB1 GB2) --> booleangeobox<
[procedure] (geobox< GB1 GB2) --> booleangeobox>
[procedure] (geobox> GB1 GB2) --> booleangeobox<=
[procedure] (geobox<= GB1 GB2) --> booleangeobox>=
[procedure] (geobox>= GB1 GB2) --> booleangeopoint-within-box?
[procedure] (geopoint-within-box? GP GB) --> booleanModule 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) --> booleancheck-geopolygon
[procedure] (check-geopolygon LOC OBJ [VARNAM]) -> geopolygonerror-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...) -> geopolygongeopolygon-closed?
[procedure] (geopolygon-closed? GPOLY) --> booleanPolygon has the same initial and final geopoint.
geopolygon-open?
[procedure] (geopolygon-open? GPOLY) --> booleanPolygon does not have the same initial and final geopoint.
geopolygon-bounding-box
[procedure] (geopolygon-bounding-box GPOLY) -> geoboxModule geopoint-utils
Usage
(import geopoint-utils)
in-closed-polygon?
[procedure] (in-closed-polygon? GP GPOLY [INTERSECTS? intersects?-pnp]) --> booleanIs 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) --> booleanDoes 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) -> realpythagorean-distance*
[procedure] (pythagorean-distance* GP1 GP2) -> realspherical-surface-distance
[procedure] (spherical-surface-distance GP1 GP2 (R EARTH-RADIUS-KILOMETERS)) -> realgreat-circle-distance
[procedure] (great-circle-distance GP1 GP2 (R EARTH-RADIUS-KILOMETERS)) -> realgreat-circle-distance-radians
[procedure] (great-circle-distance-radians GP1 GP2 (R EARTH-RADIUS-KILOMETERS)) -> realapproximate-ellipsoid-distance
[procedure] (approximate-ellipsoid-distance GP1 GP2 (R EARTH-RADIUS-KILOMETERS) (F EARTH-FLATTENING)) -> realgreat-circle-azimuth
[procedure] (great-circle-azimuth GP1 GP2 [PREC 5]) -> realgreat-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) -> realpythagorean-distance*
[procedure] (pythagorean-distance* LAT1 LON1 LAT2 LON2) -> realspherical-surface-distance
[procedure] (spherical-surface-distance LAT1 LON1 LAT2 LON2 (R EARTH-RADIUS-KILOMETERS)) -> realgreat-circle-distance
[procedure] (great-circle-distance LAT1 LON1 LAT2 LON2 (R EARTH-RADIUS-KILOMETERS)) -> realgreat-circle-distance-radians
[procedure] (great-circle-distance-radians LAT1 LON1 LAT2 LON2 (R EARTH-RADIUS-KILOMETERS)) -> realapproximate-ellipsoid-distance
[procedure] (approximate-ellipsoid-distance LAT1 LON1 LAT2 LON2 (R EARTH-RADIUS-KILOMETERS) (F EARTH-FLATTENING)) -> realgreat-circle-azimuth
[procedure] (great-circle-azimuth LAT1 LON1 LAT2 LON2 [PREC 5]) -> realgreat-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) --> booleanintersects?-pip
[procedure] (intersects?-pip LATI LONI LATJ LONJ LAT LON) --> booleanModule 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) -> realdegree->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 ""]]]) -> stringExample: 122°45'10"W
dms->string*
[procedure] (dms->string* D M S [PAD ""]) -> stringExample: 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 ""]]]) -> stringReturns the dms-string for the degrees DEG.
Module globe
Usage
(import geo-globe)
make-globe
[procedure] (make-globe RADIUS FLATTENING) -> globeglobe?
[procedure] (globe? OBJ) --> booleancheck-globe
[procedure] (check-globe LOC OBJ [VARNAM]) -> globeerror-globe
[procedure] (error-globe LOC OBJ [VARNAM])globe-radius-kilometers
[procedure] (globe-radius-kilometers GLOBE) -> numberglobe-flattening-factor
[procedure] (globe-flattening-factor GLOBE) -> numberspherical-surface-distance
[procedure] (spherical-surface-distance GLOBE GP1 GP2) -> numbergreat-circle-distance
[procedure] (great-circle-distance GLOBE GP1 GP2) -> numbergreat-circle-distance-radians
[procedure] (great-circle-distance-radians GLOBE GP1 GP2) -> numberapproximate-ellipsoid-distance
[procedure] (approximate-ellipsoid-distance GLOBE GP1 GP2) -> numbergreat-circle-azimuth
[procedure] (great-circle-azimuth GP1 GP2 [PRECISION 5]) -> numbergreat-circle-position
[procedure] (great-circle-position GLOBE GP DISTANCE AZIMUTH) -> geopointModule 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) -> globeBugs & Limitations
- Probably some.
Notes
- The relational predicates are rather useless.
- Incomplete.
- Should have functor versions of algorithms so can specialize.
Requirements
mathh srfi-1 vector-lib check-errors
Author
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.