@cobuildlab/american-arbor-shared
TypeScript icon, indicating that this package has built-in type declarations

4.2.1 • Public • Published

test

Documentation for the provided code:

Types:

  • GeoJsonPoint:

    • Represents a GeoJSON point.
    • Extends the GeoJsonGeometryInterface and GeoJsonInterface interfaces.
    • Properties:
      • __typename?: 'GeoJSONPoint' (optional)
      • bbox?: Maybe<Array<Maybe<Scalars['Float']>>> (optional, bounding box)
      • coordinates?: Maybe<Scalars['GeoJSONCoordinates']> (optional, coordinates)
      • type: GeoJsonType (geometry type, always 'Point' for this type)
  • GetLocationFromGeoJSONPointReturnType:

    • Return type of the getLocationFromGeoJSONPoint function.
    • Properties:
      • latitude: number (latitude)
      • longitude: number (longitude)

Functions:

  • getLocationFromGeoJSONPoint(data):
    • Extracts the latitude and longitude from a GeoJSON point.
    • Parameters:
      • data: A partial GeoJsonPoint object or null/undefined.
    • Returns:
      • A GetLocationFromGeoJSONPointReturnType object with latitude and longitude if the data is valid, otherwise undefined.

Example usage:

const geojsonPoint = {
  type: "Point",
  coordinates: [-74.0060, 40.7128],
};

const location = getLocationFromGeoJSONPoint(geojsonPoint);

if (location) {
  console.log(f"Latitude: {location.latitude}, Longitude: {location.longitude}");
} else {
  console.log("Invalid GeoJSON point.");
}

Readme

Keywords

Package Sidebar

Install

npm i @cobuildlab/american-arbor-shared

Weekly Downloads

12

Version

4.2.1

License

ISC

Unpacked Size

1.86 MB

Total Files

54

Last publish

Collaborators

  • alacret
  • nodejose
  • lesha12012
  • galue99