1.9.2 • Published 3 months ago

@digitregroup/map-location-factory v1.9.2

Weekly downloads
51
License
-
Repository
github
Last release
3 months ago

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 });
1.9.2

3 months ago

1.9.1

3 months ago

1.9.0

3 months ago

1.8.7

5 months ago

1.8.2

5 months ago

1.8.1

5 months ago

1.8.0

5 months ago

1.8.5

5 months ago

1.8.3

5 months ago

1.7.7

3 years ago

1.7.5

4 years ago

1.7.4

5 years ago

1.7.3

5 years ago

1.7.2

5 years ago

1.7.1

5 years ago

1.7.0

5 years ago