Class: Proximity

cercaliagl.service/Proximity


Javascript ES5

const proximityService = new cercaliagl.service.Proximity({ ... });

The Proximity service offers to obtain data given a reference and a distance or geometry. For example, given a geometry it is possible to obtain al geo entities inside it. Also it can return POIs.
All options available below in constructor options.

Example usage:

// Obtain localities (ct) inside 5km radius given center Madrid municipality. 100 candidates maximum.
const proximityService = new cercaliagl.service.Proximity({
  rqge: 'ct',
  countryId: 'ESP',
  municipality: 'Madrid',
  rad: 5000,
  numCand: 100
});
proximityService.proximity((data) => console.log(data));

new Proximity(options)

Name Type Description
options

Proximity 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.

streetId string

Street code filter.

street string

Street name filter.

street2 string

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

street2Id string

Second street code 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.

wkt string

Reference geometry.

srs string

Coordinates reference system.

x number

X coordinate central reference.

y number

Y coordinate central reference.

rqge string

Geo-entity level. Available values adr|st|ct|mun|subreg|reg|ctry.

rqpoicats Array.<string>

Array of POIs categories.

infoxml boolean

If a numeric value other than 0 is specified, it returns XML information associated with the Point of Interest.

weight number

Proximity with real route distance. Values: time, distance, money.

inverse number

Can be true or false. With a false value, the distances are calculated from the reference to the target. With a true value, the distances are calculated from the references to the targets. The default is false.

mos Array.<string>

List of coordinates (type MO).

rad number

Maximum search radius (direct distance).

Extends

  • module:cercaliagl/service/Service~Service

Methods

Clear search

getResponse(){Object}

Returns response to the query with function 'proximity'

Returns:
response

proximity(callbackFn, callbackFnError)

Make request and obtain data via callback function.

Name Type Description
callbackFn function

Callback Function

callbackFnError function

Callback Function if there is an error

setSearch(options)

Set search. Same parameters as constructor

Name Type Description
options

Proximity 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.

streetId string

Street code filter.

street string

Street name filter.

street2 string

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

street2Id string

Second street code 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.

wkt string

Reference geometry.

srs string

Coordinates reference system.

x number

X coordinate central reference.

y number

Y coordinate central reference.

rqge string

Geo-entity level. Available values adr|st|ct|mun|subreg|reg|ctry.

rqpoicats Array.<string>

Array of POIs categories.

infoxml boolean

If a numeric value other than 0 is specified, it returns XML information associated with the Point of Interest.

weight number

Proximity with real route distance. Values: time, distance, money.

inverse number

Can be true or false. With a false value, the distances are calculated from the reference to the target. With a true value, the distances are calculated from the references to the targets. The default is false.

mos Array.<string>

List of coordinates (type MO).

rad number

Maximum search radius (direct distance).