Class: Pois

cercaliagl.service/Pois


Javascript ES5

const poisService = new cercaliagl.service.Pois({ ... });

Service to obtain POIs. These POIs can be requested by POIs or category IDs. The POIs will also be obtained given a geographic extension or a geometry in WKT format.
If you need categories IDs or you want to publish later to get these POIs through the API, please contact support.
More information can be found below in the constructor options.

Example usage:

const poisService = new cercaliagl.service.Pois({
  categories: ['DOOCAM'],
  bounds: map.getBounds(),
});
poisService.doPoisRequest((data) => {
  if (data.cercalia.map.getpoicats && data.cercalia.map.getpoicats.poilist && data.cercalia.map.getpoicats.poilist.poi) {
    const pois = data.cercalia.map.getpoicats.poilist.poi
    pois.forEach((poi) => {
      console.log(poi.id, poi.name.value, poi.info.value); // Print POI ID, name and info values.
    });
  }
});

new Pois(options)

Name Type Description
options

Opciones Geocoding

Name Type Description
bounds module:cercaliagl/Bounds~Bounds | undefined

Bounds to search categories inside

buffer number | undefined

Buffer size for search

categories Array.<string> | undefined

List of categories to obtain. The 'pois' option must be null.

gridsize number | undefined

Gridsize

height number | undefined

Height in pixels.

pois Array.<string> | undefined

POIs IDs list to obtain. If this option is included, the categories property will be ignored. Does not apply any other constructor options.

searchByScale boolean | undefined

Specify if you need to group POIs depending on parameters: bounds, width and height.

width number | undefined

Width, in pixels.

wkt string | undefined

Get all the POIs from selected categories, that intersects a polygon, in WKT format

Extends

  • module:cercaliagl/service/Service~Service

Methods

clearResponse()

Clear response.

doPoisRequest(callbackFn)

Execute the server request and the callback function to be processed with the response

Name Type Description
callbackFn function

Funcion callback to parse server data's response.

Returns the WKT of the spatial query

Returns:
Coordinate

getGridsize(){number|null}

Returns:
gridsize Gridsize in pixels.

getHeigth(){number|null}

Returns:
height Height in pixels

getQueryCategories(){Array.<string>}

Returns the POIs categories to search

Returns:
categories list string

getQueryPois(){Array.<string>}

Returns the POIs list

Returns:
Returns a POI IDs array

Returns the response with the 'geocode' function request

Returns:
response

getWidth(){number|null}

Returns:
width

getWkt(){string|null}

Returns the map area corresponding to the spatial query. The format is WKT

Returns:
Geometria WKT (string)

isSearchbyScale(){boolean}

Returns:
boolean Return if shows if POIs by scale search is used. true or false.

setBounds(bounds)

Set the polygon for the spatial query. String WKT format. If spatial query use map bounds, the WKT will be ignored and must be reset next time

Name Type Description
bounds module:cercaliagl/Bounds~Bounds

Bounds

setGridsize(gridsize)

Name Type Description
gridsize number

Gridsize in pixels.

setHeight(height)

Set height

Name Type Description
height number

Height in pixels

setQueryCategories(categories)

Set the POIs list to search.

Name Type Description
categories Array.<string>

POIs ID list, in an array

setQueryPois(categories)

Set the POIs categories to search.

Name Type Description
categories Array.<string>

categories list string

setSearchbyScale(searchByScale)

Name Type Description
searchByScale boolean

Enable search by scale. true or false.

setWidth(width)

Name Type Description
width number

Width in pixels.

setWkt(wkt)

Set the polygon for the spatial query. String WKT format If spatial query use a WKT, the map bounds will be ignored and must be reset next time

Name Type Description
wkt string

WKT geometry