Class: GoNexusInfo

GoNexusInfo

Interaction that allows to get the information from nexus sensors


    Example: 
        let token: string = "api_token";
        map?.interactions.getAllsensorsFromNexus({
			location: "Sacmex",
			token: token
		}).then((response: any) => {
            const sensors = response.data;
            sensorLayer(2,sensors,getEnvVariable(REACT_APP_GEOSERVER))
            .then((res: any) => {
                if (map && olMap) {
                    let olMap = map!.getMap(gisConstants.MAP_NAME);
                    olMap!.addLayer(res);
                }
                olMap?.on("singleclick", evt => {
                    const features = olMap?.getFeaturesAtPixel(evt.pixel, {
                        layerFilter: layer =>
                            layer.getProperties().id === "estacion_medicion_presion",
                            hitTolerance: 2,
                    });
                    if (features.length) {
                        const clickedSensor = features[0].getProperties();
                        let sensor = response.data.filter((s: { gisId: String; }) => s.gisId == clickedSensor.id);
                        if(sensor && sensor.length){
                            var sensorUID = sensor[0].uid;
                            if(sensorUID != ''){                                    
                                map?.interactions.getHistoricInfoFromNexus({
									sensorUID,
									token
								}).then((response: any) => {
                                    this.setState({
                                        currentSensorHistoricValues: response.tags.map(
                                            (x: any) => [
                                                Date.parse(x.timeStamp),
                                                +x.value.toFixed(3),
                                            ]
                                        ),
                                    });
                                });
                            }
                        }
                        this.setState({
                            isModalOpen: true,
                            currentSensor: clickedSensor,
                        });
                    }
                });
                this.setState({ map });
            });
        });

new GoNexusInfo()

Interactions/ExternalsConnections/interact/Nexus/GoNexusInfo.ts, line 69

Extends

Methods

getTagviewHistoricValues(uid, token, bindingUrl){config}

Interactions/ExternalsConnections/interact/Nexus/GoNexusInfo.ts, line 78

This function return the daily information from a specific Nexus sensor.

Name Type Description
uid string

UID from specific Nexus sensor.

token string

Token provided by Nexus

bindingUrl string

The url of the api

Returns:
Type Description
config Return a config object

getTagviewsFromLocation(location, token, bindingUrl){any}

Interactions/ExternalsConnections/interact/Nexus/GoNexusInfo.ts, line 104

This function return all the sensors information from Nexus API

Name Type Description
location string

Project location variable for API call (example "Sacmex").

token string

Token provided by Nexus

bindingUrl string

The url of the api

Returns:
Type Description
any Return a config object

inherited typeLayerHidraulic(feature){string}

Interactions/utils/GoInteractionTool.ts, line 20

This function allow to create a style for the hidraulic layer.

Name Type Description
feature module:types~FeatureLike

The feature to style

Returns:
Type Description
string Return the new style of the feature.