<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Cluster multiple map services in leaflet in Open Source Mapping Libraries Ques.</title>
    <link>https://community.esri.com/t5/open-source-mapping-libraries-ques/cluster-multiple-map-services-in-leaflet/m-p/805996#M230</link>
    <description>&lt;P&gt;I am trying to cluster multiple layers in leaflet, but it doesn't seem to be working.&amp;nbsp; I have 5 rest end points that I am trying to put together to cluster using the L.markerClusterGroup().&amp;nbsp; This is what I have in my html:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;lt;script&amp;gt;&lt;BR /&gt;&amp;nbsp; var map = L.map('map').setView([50.6805, -120.3421], 12);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; L.esri.basemapLayer('Streets').addTo(map);&lt;BR /&gt;&amp;nbsp; var markers = L.markerClusterGroup();&lt;BR /&gt;&amp;nbsp; var ArtsCultureEducation = L.esri.featureLayer({&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;url: '&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fgeoprodsvr.kamloops.ca%2Farcgis3%2Frest%2Fservices%2FWebsite%2FCityFacilities_LL%2FMapServer%2F0" target="_blank" rel="nofollow noopener"&gt;http://geoprodsvr.kamloops.ca/arcgis3/rest/services/Website/CityFacilities_LL/MapServer/0&lt;/A&gt;&lt;SPAN&gt;',&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp; });&lt;BR /&gt;&amp;nbsp; var PublicSafteySite = L.esri.featureLayer({&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;url: '&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fgeoprodsvr.kamloops.ca%2Farcgis3%2Frest%2Fservices%2FWebsite%2FCityFacilities_LL%2FMapServer%2F1" target="_blank" rel="nofollow noopener"&gt;http://geoprodsvr.kamloops.ca/arcgis3/rest/services/Website/CityFacilities_LL/MapServer/1&lt;/A&gt;&lt;SPAN&gt;',&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp; });&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; markers.addLayer(PublicSafteySite);&lt;BR /&gt;&amp;nbsp; markers.addLayer(ArtsCultureEducation);&lt;BR /&gt;&amp;nbsp; map.addLayer(markers);&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The points from the 2 layers show up, but they don't cluster.&amp;nbsp; Any help would be appreciated.&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Darryl&lt;/P&gt;</description>
    <pubDate>Mon, 28 Aug 2023 13:20:02 GMT</pubDate>
    <dc:creator>DarrylKlassen1</dc:creator>
    <dc:date>2023-08-28T13:20:02Z</dc:date>
    <item>
      <title>Cluster multiple map services in leaflet</title>
      <link>https://community.esri.com/t5/open-source-mapping-libraries-ques/cluster-multiple-map-services-in-leaflet/m-p/805996#M230</link>
      <description>&lt;P&gt;I am trying to cluster multiple layers in leaflet, but it doesn't seem to be working.&amp;nbsp; I have 5 rest end points that I am trying to put together to cluster using the L.markerClusterGroup().&amp;nbsp; This is what I have in my html:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;lt;script&amp;gt;&lt;BR /&gt;&amp;nbsp; var map = L.map('map').setView([50.6805, -120.3421], 12);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; L.esri.basemapLayer('Streets').addTo(map);&lt;BR /&gt;&amp;nbsp; var markers = L.markerClusterGroup();&lt;BR /&gt;&amp;nbsp; var ArtsCultureEducation = L.esri.featureLayer({&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;url: '&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fgeoprodsvr.kamloops.ca%2Farcgis3%2Frest%2Fservices%2FWebsite%2FCityFacilities_LL%2FMapServer%2F0" target="_blank" rel="nofollow noopener"&gt;http://geoprodsvr.kamloops.ca/arcgis3/rest/services/Website/CityFacilities_LL/MapServer/0&lt;/A&gt;&lt;SPAN&gt;',&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp; });&lt;BR /&gt;&amp;nbsp; var PublicSafteySite = L.esri.featureLayer({&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;url: '&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fgeoprodsvr.kamloops.ca%2Farcgis3%2Frest%2Fservices%2FWebsite%2FCityFacilities_LL%2FMapServer%2F1" target="_blank" rel="nofollow noopener"&gt;http://geoprodsvr.kamloops.ca/arcgis3/rest/services/Website/CityFacilities_LL/MapServer/1&lt;/A&gt;&lt;SPAN&gt;',&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp; });&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; markers.addLayer(PublicSafteySite);&lt;BR /&gt;&amp;nbsp; markers.addLayer(ArtsCultureEducation);&lt;BR /&gt;&amp;nbsp; map.addLayer(markers);&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The points from the 2 layers show up, but they don't cluster.&amp;nbsp; Any help would be appreciated.&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Darryl&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2023 13:20:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/open-source-mapping-libraries-ques/cluster-multiple-map-services-in-leaflet/m-p/805996#M230</guid>
      <dc:creator>DarrylKlassen1</dc:creator>
      <dc:date>2023-08-28T13:20:02Z</dc:date>
    </item>
    <item>
      <title>Re: Cluster multiple map services in leaflet</title>
      <link>https://community.esri.com/t5/open-source-mapping-libraries-ques/cluster-multiple-map-services-in-leaflet/m-p/805997#M231</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;when Leaflet.markerCluster.addLayer() is called, an attempt is made &lt;A href="https://github.com/Leaflet/Leaflet.markercluster/blob/80dad18394a9f911cf0ea80eabac4df62556c99f/src/MarkerClusterGroup.js#L87-L91" rel="nofollow noopener noreferrer" target="_blank"&gt;immediately&lt;/A&gt;&amp;nbsp;to check whether a single lat/long can be extracted and clustered:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;// if its not possible to dig out a single lat/lon from the layer,&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// abort clustering&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;!&lt;/SPAN&gt;layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;getLatLng&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;_nonPointGroup&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;addLayer&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;layer&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;fire&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'layeradd'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt; layer&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; layer &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;so you have several problems...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. L.esri.featureLayer doesn't fetch any&amp;nbsp;features at all until&lt;EM&gt; after&lt;/EM&gt; it is added to the map and even then has to make asynchronous web requests to ask for features that intersect the area being drawn&lt;/P&gt;&lt;P&gt;2. even when these features are retrieved, they can't be pulled out of L.esri.featureLayer via the .getLatLng() method that plugin uses (above).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in the ArcGIS world, we tend to think of layers as entire collections of features with the same geometry type in a map. In Leaflet, a layer often refers to a single geometry (marker, polyline or polygon)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;unfortunately, i don't have any helpful advice for conveniently managing and clustering data coming from several different services. it would take some work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:23:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/open-source-mapping-libraries-ques/cluster-multiple-map-services-in-leaflet/m-p/805997#M231</guid>
      <dc:creator>JohnGravois</dc:creator>
      <dc:date>2021-12-12T09:23:39Z</dc:date>
    </item>
    <item>
      <title>Re: Cluster multiple map services in leaflet</title>
      <link>https://community.esri.com/t5/open-source-mapping-libraries-ques/cluster-multiple-map-services-in-leaflet/m-p/805998#M232</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks John&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Apr 2017 23:29:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/open-source-mapping-libraries-ques/cluster-multiple-map-services-in-leaflet/m-p/805998#M232</guid>
      <dc:creator>DarrylKlassen1</dc:creator>
      <dc:date>2017-04-26T23:29:16Z</dc:date>
    </item>
  </channel>
</rss>

