POST
|
Hi! I actually replied by accident with my organisation account (AdministrationOGSL), but I am actually the same person. So the issue you shared was actually posted by me. The thing is that the OGCFeatureLayer class of ArcGIS uses the OGC API - Features, and not WFS. The OGC API - Features is a service to access features, but that is newer than WFS. So to use it, this service (OGC API-Features) has to be added to the capabilities of the geoserver that you use. If it is the geoserver of your organisation, this can be easily done (https://docs.geoserver.org/latest/en/user/community/ogc-api/index.html ). If not, I think your best bet would be tu use another module to create your map (such as OpenLayers). Hope this helps!
... View more
05-20-2021
05:20 AM
|
1
|
1
|
2119
|
POST
|
Same question here. Have you found a way to avoid popups to appear when no wms features are clicked? Thank you!
... View more
02-17-2021
10:26 AM
|
0
|
0
|
709
|
POST
|
Hello, I would like to know how you got to access the attribute values from each point of the Feature Layer created? If I add what the code below to yours and I click on the point of the map, the only attributes of the point is the one set as the objectIDField. view.on("click", function(event) { //console.log(event) view.hitTest(event).then(getGraphics); }); function getGraphics(response) { console.log(response.results[0].graphic.attributes) } How can one access the attributes set when the graphic point is created? Thank you!
... View more
11-16-2020
10:30 AM
|
0
|
0
|
3938
|
POST
|
I am so sorry, there is a small error in the code above. If you could replace the creation of the OGCFeatureLayer by this, it will work (I no longer use my local server!): var layer_regions = new OGCFeatureLayer({ url: "https://geoserver.preprod.ogsl.ca/geoserver/ogc/features/", collectionId: "robitaillej:test_create_shp", legendEnabled: true, popupEnabled: true, name: "layer_regions", visible: true, title: "regions", renderer: { type: "simple", symbol: { type: "simple-fill", }, } });
... View more
11-13-2020
07:29 AM
|
0
|
0
|
6268
|
POST
|
Hello, Thanks for your reply. Here is a sample of my code. I tried to get ride of everything that would still reproduce the error: <!DOCTYPE html> <html lang="en"> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"> </script> <script type="text/javascript" src="https://d3js.org/d3.v6.js"></script> <link rel="stylesheet" href="https://js.arcgis.com/4.17/esri/themes/dark/main.css"> <script src="https://js.arcgis.com/4.17/"></script> <script> require([ // require loads modules "esri/Map", "esri/views/MapView", "esri/widgets/BasemapToggle", "esri/layers/OGCFeatureLayer", "esri/Graphic", "esri/layers/GraphicsLayer", "esri/geometry/Point", ], function(Map, MapView, BasemapToggle, OGCFeatureLayer, Graphic, GraphicsLayer, Point) { var map = new Map({ basemap: "topo-vector" }); var view = new MapView({ container: "viewDiv", map: map, center: [-68.80500, 47.02700], // longitude, latitude zoom: 7 }); //load stations info: var stations = []; $.ajax({ // TODO: fix CORS Error — and How the Access-Control-Allow-Origin Header url: "https://api.iwls.azure.cloud.dfo-mpo.gc.ca/api/v1/stations", type: "GET", async: false, contentType: 'application/json; charset=utf-8', success: function(json) { stations = json; } }); //load regions var layer_regions = new OGCFeatureLayer({ url: "http://localhost:32768/geoserver/OGSL/ogc/features/", collectionId: "OGSL:test_create_shp_exposed", legendEnabled: true, popupEnabled: true, name: "layer_regions", visible: true, title: "regions", renderer: { type: "simple", symbol: { type: "simple-fill", }, } }); map.add(layer_regions); view.on("click", function(event) { //console.log(event) view.hitTest(event).then(getGraphics).then(buildLayer); }); function getGraphics(response) { // On vérifie s'il y a déjà une couche des stations d'affichée var foundLayers = map.allLayers.find(function(layer) { return layer.name === "stationsLayerTrue"; }); console.log("foundlayers", foundLayers) //Si on clique sur un couche de type polygone if (response.results[0].graphic.geometry) { if (response.results[0].graphic.geometry.type === "polygon") { var geometry = response.results[0].graphic.geometry // Si une couche des stations est déjà présente, on la supprime if (foundLayers) { map.remove(foundLayers) } // On zoom sur le poylgone cliqué view.goTo(response.results[0].graphic.geometry); var popupActive = false return geometry; } } else { var foundLayers = map.allLayers.find(function(layer) { return layer.name === "stationsLayerTrue"; }); if (foundLayers) { map.remove(foundLayers) } return null } } function buildLayer(polygoneClique) { //console.log("poly", polygoneClique) if (polygoneClique) { // On crée une couche qui va contenir les stations var stationsLayerTrue = new GraphicsLayer({ visible: true, title: "stationsLayerTrue", name: "stationsLayerTrue" }); map.add(stationsLayerTrue); for (i = 0; i < stations.length; i++) { var point = new Point({ longitude: stations[i]["longitude"], latitude: stations[i]["latitude"], spatialReference: { wkid: 3857 } }) var intersects = polygoneClique.contains(point) if (intersects) { var pointGraphicTrue = new Graphic({ geometry: point, symbol: { type: "simple-marker", color: "#d7191c" //red }, popupTemplate: { title: "{officialName}" }, attributes: { id: stations[i]["id"], officialName: stations[i]["officialName"], } }); stationsLayerTrue.add(pointGraphicTrue); } } } } }); </script> <style> html, body, #viewDiv { position: absolute; left: 0; right: 0px; top: 0; bottom: 0; height: 100%; } .esri-legend__layer-caption { display: none; } </style> </head> <body> <div id="viewDiv"></div> </body> </html> So as you can see, if you click on one region and then click on a point, the highlight works fine. But if you then click on the other region and then on a point, the error shows up. Any idea of why this is happening? Thank you ! Julien
... View more
11-13-2020
07:25 AM
|
0
|
1
|
6270
|
POST
|
Hello, I was wondering if it was normal how slow arcgis API JS laods WMS layers.Here is an example: <html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no"> <title>Intro</title> <style> html, body, #viewDiv { padding: 0; margin: 0; height: 100%; width: 100%; } </style> <link rel="stylesheet" href="https://js.arcgis.com/4.17/esri/css/main.css"> <script src="https://js.arcgis.com/4.17/"></script> <script> require(["esri/Map", "esri/views/MapView", "esri/layers/WMSLayer", "esri/widgets/LayerList"], function( Map, MapView, WMSLayer, LayerList, ) { const map = new Map({ basemap: "streets-navigation-vector" }); const view = new MapView({ container: "viewDiv", map: map, zoom: 3, center: { latitude: 32.7353, longitude: -117.1490 } }); var layer_precipitations = new WMSLayer({ url: "https://geo.weather.gc.ca/geomet?", title: "Précipitation radar", sublayers: [{ name: "RADAR_1KM_RRAI", title: "precipitations", popupEnabled: false, queryable: false, visible: true, }, ], visible: true, }); map.add(layer_precipitations); var layerList = new LayerList({ view: view, }); view.ui.add(layerList, { position: "top-left" }); }); </script> </head> <body> <div id="viewDiv"></div> </body> </html> The page takes about 4 seconds to load with chrome, and about 8 seconds with firefox. If I try loading the same layer with leaflet or openlayers, it doesnt even take 1 second. Any one knows how I can make it faster? Thank you! Julien
... View more
11-12-2020
11:10 AM
|
0
|
0
|
685
|
POST
|
Hello, I am using ArcGIS api JS with a layer of polygons. When I click on one polygon, it creates a layer of points that intersect the polygon clicked. When I then click on a point, the point gets highlighted correctly. The problem is that once I have clicked at least once on a point and got it highlighted, if I then click on a polygon or anywhere else on the map where there is no polygons, this error occurs: Uncaught (in promise) TypeError: Cannot read property 'setHighlight' of null at d.f._updateHighlight (mapViewDeps.js:773) at d.f.removeHighlight (mapViewDeps.js:773) at Object.remove (GraphicsLayerView2D.js:7) at d.c.remove ((index):751) at d.<anonymous> ((index):2352) at g ((index):38) at Object.next ((index):37) at (index):37 at new Promise (<anonymous>) at Object.f [as __awaiter] ((index):36) And when I then click again on a point, the point doesnt highlight anymore. But the popup works fine. One the highlight is not working. I would like to know where is the poperty "setHighlight" and how can I avoid the issue? If only I was able to pin point where the property is, I could probably undesrtand what is happening. But there is no info online about this property nor the issue. So thank you for any of your help, it is really appreciated! Julien
... View more
11-10-2020
07:31 AM
|
0
|
4
|
6293
|
POST
|
Hello, I am trying to use the LineChartMediaInfo element in order to plot a simple array of points in the popup content. However, I dont really know how to make it work. Can the fields of the values contain arrays? Here is part of my code with a test array "array1" containing 4 numbers. var pointGraphic = new Graphic({ geometry: point, symbol: simpleMarkerSymbol, popupTemplate: popupTemplate, attributes: { array1: [1, 2, 3, 4], longitude: metadata["longitude"], latitude: metadata["latitude"] } }); var popupTemplate = { title: metadata["officialName"], content: [ { // Pass in the fields to display type: "media", mediaInfos: [{ title: "<b>Prédiction</b>", type: "line-chart", value: { fields: ["array1"], normalizeField: null } } ] }] }; I cant figure out from the doc (LineChartMediaInfo | ArcGIS API for JavaScript 4.17 )why it give me something like that: Thanks a lot for your help! Julien
... View more
10-23-2020
09:12 AM
|
0
|
0
|
442
|
POST
|
Hello, I actually found what was the problem (it was actually just the brackets that were not supposed to be there). When I found the issue, I set the discussion as "obsolete". But thanks anyway to have given it a try! Julien
... View more
10-07-2020
08:06 AM
|
0
|
0
|
1887
|
POST
|
Hello, I am trying to get the CQL_FILTER working in order to filter WMSLayer filtered. I am using the customLayerParameters to do that: const layer_oiseaux = new WMSLayer({ url: "https://ogsl.ca/geoserver/eccc_atlas/wms?", sublayers: [ { name: "eccc_atlas:AireEtude_Publ_janv2019", popupEnabled: true, queryable: true, } ], visible: true, customLayerParameters: [{ CQL_FILTER: "shape_leng>1000" }] }); map.add(layer_oiseaux); Hoever, nothing is happening, the parameter CQL_FILTER doesn't seem to work. Is this normal? Is there another way to filter WMS layers? Thank you!
... View more
10-02-2020
09:48 AM
|
0
|
2
|
1941
|
POST
|
Wrong link: MapView | ArcGIS API for JavaScript 4.16
... View more
10-02-2020
08:47 AM
|
0
|
0
|
483
|
POST
|
Hello, From this page: SceneView - hitTest | ArcGIS API for JavaScript 4.16 I can understand that the hittest for WMSLayer or OGCFeatureLayer will not work. Is this correct? Is there an work around to interact with those types of layers the way hittest would work? Thank you for your help! Julien
... View more
10-02-2020
08:10 AM
|
0
|
1
|
510
|
POST
|
Hello, From the documentation, to enable a popup using the OGCFeatureLayer you first need to set popupEnable to true, and either set Popup.defaultPopuTemplateEnabled to true or use your own template. I have tried bith things, neither of them work. When I click on a feature in the map, nothing is happening. Here is the relevant section of my code: Popup.defaultPopupTemplateEnabled = true; var layer_marais = new OGCFeatureLayer({ url: "http://localhost:32769/geoserver/ogc/features/", collectionId: "OGSL:marais_pointe-fortin_ichtyo_longt_2019", legendEnabled: true, popupEnabled: true, }) Anybody have the same issue, or could help me with it? Thanks in advanced!
... View more
09-30-2020
10:29 AM
|
0
|
2
|
736
|
POST
|
Hello, I am using ArcGIS dev Javascript 4.16 API and I want to use the new OGCFeatureLayer to add a WFS layer. However, I cannot make it appear on my map! Here is the related code: var layer_WFS = new OGCFeatureLayer({ url: "https://ogsl.ca/geoserver/eccc_atlas/ows", collectionId: "eccc_atlas:Ens_topo_ouvert" }) map.add(layer_WFS) Is there anyone who successfully added a WFS layer using the OGCFeatureLayer class? Thank you for your help!
... View more
09-25-2020
06:57 AM
|
1
|
0
|
527
|
Title | Kudos | Posted |
---|---|---|
1 | 05-20-2021 05:20 AM | |
1 | 09-25-2020 06:57 AM | |
3 | 09-23-2020 09:13 AM | |
1 | 09-30-2020 11:00 AM |
Online Status |
Offline
|
Date Last Visited |
05-25-2021
08:00 AM
|