I try to understand the folowing error :TypeError: Cannot read properties of null (reading 'targetGeometry')in my code.I just define a featurelayer :
I am going to guess that your basemap is a different spatial reference than your service. When you query against the service, the SR will be the original SR of the service. You can. request the geometries to be converted to match your map like this.
function zoomToLayer(layer) { // create query from layer const query = layer.createQuery(); // ask for SR to match the View query.outSpatialReference = view.spatialReference; return layer.queryExtent(query).then((response) => { view.goTo(response.extent) }); }
Thank's a lot. It's true I use a local SR for my feature layer Have a nice day
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.