V
V
vasy79912019-05-26 22:58:22
JavaScript
vasy7991, 2019-05-26 22:58:22

How to implement search in the graphic layer?

I'm using ArcGIS API for JavaScript 4.11. There is a method that accepts JSON data. Based on this data, points are created and added to the graphics layer. How to implement search in the graphic layer? I found an example how to implement search in FeatureLayer ( https://developers.arcgis.com/javascript/latest/sa... ). How to do the same in GraphicsLayer?
Method that draws dots:

function draw_point_layer(stations, list_name_net) {
                console.log(stations);
                for (i = 0; i < stations.length; i++) {
                    var point = {
                        type: "point", // autocasts as new Point()
                        longitude: stations[i]['longitude'],
                        latitude: stations[i]['latitude']
                    };
                    var pointAtt = {
                        Code: stations[i]['sitecode'],
                        Name: "<a href='" + stations[i]['link'] + "'>" + stations[i]['name'] + "</a>",
                        Type: stations[i]['type'],
                        Nets: list_name_net[i]
                    };
                    var pointGraphic = new Graphic({
                        geometry: point,
                        symbol: markerSymbol,
                        attributes: pointAtt,
                        popupTemplate: {
                            content: [{
                                type: "fields",
                                fieldInfos: [
                                    {
                                        fieldName: "Code",
                                        label: 'Код',
                                    },
                                    {
                                        fieldName: "Name",
                                        label: 'Имя',
                                    },
                                    {
                                        fieldName: "Type",
                                        label: 'Тип',
                                    },
                                    {
                                        fieldName: "Nets",
                                        label: 'Сети',
                                    },
                                ]
                            }]
                        }
                    });
                    pointLayer.add(pointGraphic);
                }
            }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question