Class: Geocoding

cercaliagl.service/Geocoding


Javascript ES5

const geocodingService = new cercaliagl.service.Geocoding({ ... });

Geocoding service class offers a service to make requests to the Cercalia webservice (https://www.cercalia.com/Documentacion/webservices/Geocodificacion) via Javascript. There are all possible options below, in the constructor description.

If you need a list of ID entities you should contact with Cercalia support.

Example usage:

const geocodingService = new cercaliagl.service.Geocoding({
  countryId: countryId,
  municipality: municipality !== '' ? municipality : null,
  postalCode: pcode !== '' ? pcode : null,
  address: address !== '' ? address : null,
});

geocodingService.geocode((data) => {
  console.log(data);
});

new Geocoding(options)

Name Type Description
options

Geocoding control options.

Name Type Description
name string

Name filter.

countryId string

Country code filter.

country string

Country name filter.

regionId string

Region code filter.

region string

Region name filter.

subregionId string

Subregion code filter.

subregion string

Subregion name filter.

subOrRegion string

Region & Subregion name filter.

municipalityId string

Municipality code filter.

municipality string

Municipality name filter.

cityId string

City code filter.

city string

City name filter.

postalCode string

Postal Code filter, requires country code.

address string

Address filter, including house number.

streetId string

Street code filter.

street2Id string

Second street code filter, for intersection search between main street and second street.

street string

Street name filter.

street2 string

Second street name filter, for intersection search between main street and second street.

housenumber number

House number filter.

roadName string

Road name filter.

roadId string

Road code filter.

km number

Mile marker filter only for roads.

fullSearch string

Resolves all the candidate parameters.

numCand string

Maximum number of candidates per page.

posCand number

First candidate position, starting from 0.

num number

Maximum number of candidates.

poicat string

List of Points of Interest - POIs.

poiId string

POI code filter.

poiName string

POI name filter.

Extends

  • module:cercaliagl/service/Service~Service

Methods

Clear search.

geocode(callbackFn)

AJAX request

Name Type Description
callbackFn function

Callback Function to parse server data.

getResponse(){Object}

Returns the response once the 'geocode' function finished

Returns:
response

setSearch(options)

Name Type Description
options

Geocoding search options.

Name Type Description
name string

Name filter.

countryId string

Country code filter.

country string

Country name filter.

regionId string

Region code filter.

region string

Region name filter.

subregionId string

Subregion code filter.

subregion string

Subregion name filter.

subOrRegion string

Region & Subregion name filter.

municipalityId string

Municipality code filter.

municipality string

Municipality name filter.

cityId string

City code filter.

city string

City name filter.

postalCode string

Postal Code filter, requires country code.

address string

Address filter, including house number.

streetId string

Street code filter.

street2Id string

Second street code filter, for intersection search between main street and second street.

street string

Street name filter.

street2 string

Second street name filter, for intersection search between main street and second street.

housenumber number

House number filter.

roadName string

Road name filter.

roadId string

Road code filter.

km number

Mile marker filter only for roads.

fullSearch string

Resolves all the candidate parameters.

numCand string

Maximum number of candidates per page.

posCand number

First candidate position, starting from 0.

num number

Maximum number of candidates.

poicat string

List of Points of Interest - POIs.

poiId string

POI code filter.

poiName string

POI name filter.