Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cartographer

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cartographer

GeoSearch through different providers

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Cartographer

This package tries to make integration with different map providers easier by returning the same result whether you are using gmaps, osm, etc.

Install

npm i cartographer

How to use

Google maps

Get here your API Key

const { createGmaps } = require('cartographer')
const gmaps = createGmaps({
  params: { key: 'YOUR_GMAPS_API_KEY_HERE' }
})

const result = await gmaps.search('Barcelona') // returns an array of locations.

Open Street Map

const { createOSM } = require('cartographer')
const osm = createOSM()
const result = await osm.search('Barcelona') // returns an array of locations.

In the case of osm you can request the geojson of a location by passing their osmId:

const geojson = await osm.searchGeoJSON(347950) // returns the geojson of Barcelona.

Also, if you have an osm object (raw) you can pass it to get an updated response. The method will take from the object the osm_id and the osm_type to collect the osm info:

const result = await osm.searchGeoJSON({
  // ... the rest of the object is ignored.
  osm_id:"347950",
  osm_type:"relation"
}) // returns an array with the location Object

Common search response for all integrations (Location Objects)

const result = [{
  address: String,
  lon: Number,
  lat: Number,
  bbox: [
    [Number, Number], // south - lat, west - lon
    [Number, Number]  // north - lat, east - lon
  ],
  raw: {} // unprocessed response, as returned by the source
}]

Keywords

FAQs

Package last updated on 14 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc