1.1.4 • Published 8 years ago

geo-core v1.1.4

Weekly downloads
5
License
MIT
Repository
github
Last release
8 years ago

geo-core

Toolkit that includes fast look up of locations by latitude and longitude pairs.

npm install geo-core --save

Requiring

var Geolocation = require('geo-core')

Constructing

Create an instance of the Geolocation class. When constructing, will require a JSON file that contains all cities with a population of 5000 or above.

var GeoManager = new Geolocation();

Options

GeoLocation also takes options to override defaults for any reason.

var GeoManager = new Geolocation({
  radiansConversion: Math.PI / 2,
  radius: 3959,
  units: 'miles',
  minimumLocations: 3
});
PropertyTypeDescriptionDefault
radiansConversionFloatList of messages to displayπ / 180
radiusIntegerRadius of the spherical object, defaults to Earth.3959
unitsStringUnit of measurement corresponding to the radius'miles'
minimumLocationsIntegerMinimum number of nearby locations returned.3

API

A GeoManager instance exposes the following functions:

findNearbyLocations(Object, Function)

Returns an array of Geolocation Objects closest to the supplied Origin Location Object

GeoManager.findNearbyLocations({
  lat: '35.73265',
  lon: '-78.85029'
}, function(locations) {
  // ... Array of geolocation objects.
});

Geolocation Friendly Objects

Origin Location Object

PropertyTypeDescription
lonString (Float)Longitude coordinate associated with the origin position.
latString (Float)Latitude coordinate associated with the origin position.

Geolocation Object

PropertyTypeDescription
cityStringCity associated with the location.
divisionStringDivision / Province / State associated with the location.
countryStringCountry associated with the location.
populationIntegerTotal population of the location.
longitudeFloatLongitude coordinate associated with the location.
latitudeFloatLatitude coordinate associated with the location.
distanceFloatDistance away from the origin to the location.
unitsStringUnit of measure associated with the distance

geocore has no dependencies other than the cities5000.txt.

Special Thanks

  • Austin Kelleher
  • Phil Gates-Idem
  • Mark Smith-Guerrero
1.1.4

8 years ago

1.1.3

8 years ago

1.1.2

8 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.9

9 years ago

1.0.8

9 years ago

1.0.7

9 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.3

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago