Ahoj všichni. Mám potíže s webovou mapou a webovou aplikací, které vytvářím prostřednictvím portálu ArcGIS Online své organizace.
Mám webovou mapu s několika vrstvami a u některých vyskakovacích oken různých vrstev jsem nakonfiguroval(a) výrazy atributů. Použitý kód vypadá takto:
<SPAN class="comment token">// Převod linií/polygonů na body</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>
Vyskakovací okno funguje správně, ale když se pokusím ve webové aplikaci zobrazit atributovou tabulku této vrstvy, nenačtou se žádné záznamy. V konzoli Chromu se zobrazuje chyba „Error: Runtime Error: Cannot call member method on null.“
Změna kódu na:
<SPAN class="comment token">// Převod linií/polygonů na body</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>
problém skutečně vyřeší. Není to samozřejmě ideální, protože pro uživatele je takový výstup mnohem hůře čitelný. Zdá se, že problém způsobuje přístup k atributům geometrie.
Napadá někoho, proč se to děje?