Hallo allemaal. Ik heb problemen met een webmap en webapp die ik bouw via het ArcGIS Online-portaal van mijn organisatie.
Ik heb een webmap met meerdere lagen en heb voor sommige pop-ups van verschillende lagen attribuutexpressies ingesteld. De code die ik gebruik ziet er als volgt uit:
<SPAN class="comment token">// Lijnen/polygonen omzetten in punten</SPAN>
<SPAN class="keyword token">var</SPAN> PointGeometry <SPAN class="operator token">=</SPAN> <SPAN class="token function">Centroid</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="token function">Geometry</SPAN><SPAN class="punctuation token">(</SPAN>$feature<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> pointX <SPAN class="operator token">=</SPAN> PointGeometry<SPAN class="punctuation token">.</SPAN>x<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> pointY <SPAN class="operator token">=</SPAN> PointGeometry<SPAN class="punctuation token">.</SPAN>y<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">return</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="token function">text</SPAN><SPAN class="punctuation token">(</SPAN>pointX<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">+</SPAN> <SPAN class="string token">":"</SPAN> <SPAN class="operator token">+</SPAN> <SPAN class="token function">text</SPAN><SPAN class="punctuation token">(</SPAN>pointY<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
De pop-up werkt prima, maar wanneer ik de attribuuttabel voor deze laag in de webapp probeer te bekijken, worden er nooit records geladen. In de console van Chrome krijg ik de foutmelding "Error: Runtime Error: Cannot call member method on null."
De code wijzigen in:
<SPAN class="comment token">// Lijnen/polygonen omzetten in punten</SPAN>
<SPAN class="keyword token">var</SPAN> PointGeometry <SPAN class="operator token">=</SPAN> <SPAN class="token function">Centroid</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="token function">Geometry</SPAN><SPAN class="punctuation token">(</SPAN>$feature<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">return</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="token function">text</SPAN><SPAN class="punctuation token">(</SPAN>PointGeometry<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
lost het probleem inderdaad op. Dit is natuurlijk niet ideaal, omdat het voor gebruikers veel moeilijker leesbaar is. Het lijkt erop dat het ophalen van de geometrieattributen het probleem veroorzaakt.
Heeft iemand enig idee waarom dit gebeurt?