Hierarchy

  • NgwConnector
    • default

Constructors

Properties

cache: default<any, Record<string, unknown>>
emitter: EventEmitter<DefaultEventMap> = ...
id: number = ...
resources: ResourcesControl
user?: UserInfo
withCredentials?: boolean = undefined
errors: __module = errors

Methods

  • Send request to NGW api router.

    Type Parameters

    Parameters

    Returns Promise<P[K]>


    // there is such an NGW route item
    // "feature_layer.feature.item": [
    // "/api/resource/{0}/feature/{1}",
    // "id",
    // "fid"
    // ],

    const connector = new NgwConnector({ baseUrl: 'https://example.nextgis.com' });
    connector.apiRequest('feature_layer.feature.item', {
    // request params for {0} and {1}
    'id': 2011,
    'fid': 101,
    // query params
    'srs': 4326,
    'geom_format': 'geojson',
    }, { method: 'GET' });
    // send get-request to 'https://example.nextgis.com/api/resource/2011/feature/101?srs=4326&geom_format=geojson'
  • Establishing a connection with NextGIS Web to fulfill all other requests.

    Parameters

    Returns Promise<PyramidRoute>

    This method need not be called manually as it is used when forming a request in apiRequest. Can be used to check connection.

    const connector = new NgwConnector({ baseUrl: 'https://demo.nextgis.com' });
    connector.connect()
    .then(() => console.log('Ok'))
    .catch((er) => console.log('Connection problem', er));
  • Fast way to specify the connection address to NextGIS Web. The current connection will be severed.

    Parameters

    • baseUrl: string

      NGW url

    Returns void