Socket
Socket
Sign inDemoInstall

@digitregroup/map-location-factory

Package Overview
Dependencies
12
Maintainers
4
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @digitregroup/map-location-factory

Map and location factory


Version published
Weekly downloads
22
increased by57.14%
Maintainers
4
Created
Weekly downloads
 

Readme

Source

map-location-factory

How to use

Front-end

  • Install the last npm package
  • Import the library
  • use the autocompleteAdapter plugin

Back-end

  • Install the last npm package
  • Import the library
  • use the API public function suggest, geocode, reverse.

The library

Constructor params :

    const engine = new GeocoderEngine(
        'Here', {
            "apiKey":   "API_KEY",
            "cacheEnable": false,
            "cacheUrl": "https://geocoder-stage.digitregroup.io",
            "cacheKey": "CACHE_KEY"
            "lookup": {
              "baseUrl": "https://lookup.search.hereapi.com/v1/",
              "path": "",
              "resource": "lookup"
            },
            "geocode": {
              "baseUrl": "https://geocode.search.hereapi.com/v1/",
              "path": "",
              "resource": "geocode",
              "options": {
                "limit": 2,
                "lang": "fr",
                "country": "FRA,GLP,GUF,MTQ,REU,MYT,BLM,MAF,NCL,PYF,SPM,ATF,WLF"
              }
            },
            "reverse": {
              "baseUrl": "https://revgeocode.search.hereapi.com/v1/",
              "path": "",
              "resource": "revgeocode",
              "options": {
                "limit": 2,
                "lang": "DEU"
            }
        });

Options (suggest, geocode, reverse) :

paramstypevalue
optionsobject{}
options.termstringAddress, city, postalCode,...
options.countryarray_string or array'FRA' or 'FRA,DEU' or ['FRA','DEU']
default : 'FRA', 'GLP', 'GUF', 'MTQ', 'REU', 'MYT', 'PYF', 'SPM', 'WLF', 'MAF', 'BLM'
options.typesarray_string'area,city,postalCode'
options.limitint10
options.langstring'fr'

All options of Here API are accepted, For more information : https://www.here.com/docs/bundle/geocoding-and-search-api-v7-api-reference/page/index.html


Here suggest API

params :
paramstypevalue
termstringA city or postalCode,...
exemples :
    engine.suggest({
      term: 'Montpellier',
    }, (results, status) => {
      results.map(r => r.label)
          .indexOf('Montpellier')
          .should.equal(-1);

      status.should.be.eql(200);
    });
  })

Here Geocode API

params :
paramstypevalue
idstringHere ID
textstringAn address
exemples :
    engine.geocode({
        id: 'here:cm:namedplace:20098349'
    });

    engine.geocode({{
        text: '1 rue de Rivoli, Paris'
    });

Here Reverse API

params :
paramstypevalue
latitudenumberlatitude coordinate
longitudenumberlongitude coordinate
exemple :
    engine.reverse({ latitude: 48.8555, longitude: 2.36039 });

FAQs

Last updated on 29 Feb 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc