NextGIS Frontend
    Preparing search index...

    Module @nextgis/ngw-connector

    NgwConnector

    size version

    A lightweight HTTP client optimized for use with NextGIS Web API.

    Important

    The typed NgwConnector.route() API requires declarations generated for your NextGIS Web deployment. Install @nextgis/ngw-types-loader and run it before using route(). The declarations depend on the components and extensions installed on that server.

    npx @nextgis/ngw-types-loader https://your-ngw-server.com
    

    See the NGW Types Loader documentation for detailed instructions.

    Make sure CORS is registered in the NextGIS Web settings to be able to send requests.

    Simply download and include with a script tag, NgwConnector will be registered as a global variable.

    <script src="../lib/ngw-connector.global.js"></script>

    <script>
    var ngwConnector = new NgwConnector({
    baseUrl: 'https://demo.nextgis.com',
    });
    </script>

    unpkg

    <script src="https://unpkg.com/@nextgis/ngw-connector"></script>
    

    jsdelivr

    <script src="https://cdn.jsdelivr.net/npm/@nextgis/ngw-connector"></script>
    

    We recommend linking to a specific version number /ngw-connector@[version]

    npm install @nextgis/ngw-connector
    

    NgwConnector.route() uses declarations generated by NextGIS Web itself. Install the loader as a development dependency:

    npm install --save-dev @nextgis/ngw-types-loader
    

    Then generate types from the NextGIS Web deployment your application connects to:

    npx @nextgis/ngw-types-loader https://your-ngw-server.com
    

    If the URL is omitted, the loader uses https://demo.nextgis.com:

    npx @nextgis/ngw-types-loader
    

    The declarations are installed as resolvable packages under node_modules/@nextgisweb; no tsconfig.json changes are required. Run the loader again after changing the NextGIS Web version, components, or extensions.

    For more details, refer to the NGW Types Loader.

    import NgwConnector from '@nextgis/ngw-connector';

    const ngwConnector = new NgwConnector({
    baseUrl: 'https://demo.nextgis.com',
    // auth: {login, password}
    });

    ngwConnector
    .route('resource.item', { id: 485 })
    .get()
    .then((data) => {
    console.log(data);
    });

    ngwConnector.route('resource.collection').patch({ json: RESOURCE });
    ngwConnector.route('feature_layer.feature.collection', { id }).patch({
    json: ITEMS,
    query: {
    srs: 4326,
    geom_format: 'geojson',
    },
    });
    ngwConnector
    .route('feature_layer.feature.item', { id, fid })
    .put({ json: ITEM });
    ngwConnector.route('feature_layer.feature.item', { id, fid }).delete();

    // Shortcuts methods to find resources
    ngwConnector.getResource(2011); // by id
    ngwConnector.getResource('keyname'); // by keyname

    ngwConnector.getResources({ cls: 'vector_layer', parent__id: 0 }); // find resources by partial resource params
    ngwConnector.getResource({ display_name: 'My layer', parent__id: 0 }); // get first

    Check out the API Documentation

    NextGIS Web API Doc

    ngwConnector.get(request_name, request_options, arguments);
    

    request_options

    API request names

    Need to fix a bug or add a feature to @nextgis/ngw-connector? We provide custom development and support for this software. Contact us to discuss options!

    http://nextgis.com

    default
    BasemapResource
    BasemapWebmap
    BasemapWebmapItem
    BaseRequestOptions
    BookmarkProperties
    CreatedResource
    Credentials
    DeleteRequestItemsResponseMap
    FeatureItem
    FeatureItemAttachment
    FeatureItemExtensions
    FeatureLayerCount
    FeatureLayerField
    FeatureLayersIdentify
    FeatureLayersIdentifyItems
    FeatureResource
    FileBucket
    FileMeta
    FileUploadResp
    GetChildrenOfOptions
    GetRequestItemsResponseMap
    GetRequestOptions
    IdOnly
    LayerFeature
    LayerLegend
    LoadingQueue
    LookupTableResource
    LunkwillData
    MethodRequestOptions
    NgwConnectorOptions
    NgwDateFormat
    NgwExtent
    NgwFile
    NgwLayerIdentifyError
    NgwTimeFormat
    Params
    PatchRequestItemsResponseMap
    Permission
    PostRequestItemsResponseMap
    PutRequestItemsResponseMap
    PyramidRoute
    PyramidSettingsPyramid
    RequestHeaders
    RequestItemsParamsMap
    RequestItemsResponseMap
    RequestOptions
    RequestOptionsBody
    RequestOptionsJSON
    Resmeta
    Resource
    ResourceHierarchy
    ResourceItem
    ResourceItemMain
    ResourceStoreItemDefault
    RouteMethods
    RouteRequestOptions
    SrsItem
    TreeGroup
    TreeItem
    TreeLayer
    UserInfo
    VectorLayer
    VectorLayerResourceItem
    WebmapResource
    WmsClientConnection
    WmsClientLayer
    WmsServerService
    WmsServerServiceLayer
    ApiRouteParams
    CompositeFor
    DeleteRequestOptions
    FeatureItemToNgw
    GeometryType
    GetRouteParam
    KeysWithMethodAndPath
    KeysWithMethods
    KeysWithPaths
    Method
    MethodAvailable
    NgwDateTimeFormat
    NgwExceptions
    PatchRequestOptions
    PostRequestOptions
    PutRequestOptions
    PyramidSettings
    RequestItemAdditionalParams
    RequestItemKeys
    RequestItemsParams
    RequestMethod
    RequestMethods
    RequestOptionsByMethod
    RequestTransformFunction
    ResourceCls
    ResourceDefinition
    ResourceIdKeynameDef
    ResourceItemDatatype
    ResourceStoreItem
    ResourceStoreItemProperties
    ResponseType
    RouteBody
    RouteName
    RouteParameters
    RouteQuery
    Router
    RouteResp
    RouteResults
    ToReturn
    VectorFieldDatatype