{"id":20270991,"url":"https://github.com/mapsplugin/marker_cluster_demo","last_synced_at":"2025-03-04T00:00:00.746Z","repository":{"id":74403455,"uuid":"101452833","full_name":"mapsplugin/marker_cluster_demo","owner":"mapsplugin","description":null,"archived":false,"fork":false,"pushed_at":"2018-05-28T19:39:34.000Z","size":20354,"stargazers_count":0,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-14T05:44:23.987Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mapsplugin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-26T00:55:08.000Z","updated_at":"2018-05-28T19:39:35.000Z","dependencies_parsed_at":"2023-04-24T12:24:14.247Z","dependency_job_id":null,"html_url":"https://github.com/mapsplugin/marker_cluster_demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapsplugin%2Fmarker_cluster_demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapsplugin%2Fmarker_cluster_demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapsplugin%2Fmarker_cluster_demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapsplugin%2Fmarker_cluster_demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mapsplugin","download_url":"https://codeload.github.com/mapsplugin/marker_cluster_demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241758954,"owners_count":20015249,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T12:35:29.534Z","updated_at":"2025-03-04T00:00:00.708Z","avatar_url":"https://github.com/mapsplugin.png","language":"JavaScript","readme":"# marker cluster demo\n\n![](./demo.gif)\n\n```js\ndocument.addEventListener(\"deviceready\", function () {\n\n    var mapDiv = document.getElementById(\"map_canvas\");\n    var options = {\n        'camera': {\n            'target': data[0].position,\n            'zoom': 3\n        }\n    };\n    var map = plugin.google.maps.Map.getMap(mapDiv, options);\n    map.on(plugin.google.maps.event.MAP_READY, onMapReady);\n});\n\n\nfunction onMapReady() {\n    var map = this;\n\n    var label = document.getElementById(\"label\");\n\n    //------------------------------------------------------\n    // Create a marker cluster.\n    // Providing all locations at the creating is the best.\n    //------------------------------------------------------\n    map.addMarkerCluster({\n      //debug: true,\n      //maxZoomLevel: 5,\n      markers: data,\n      icons: [\n          {min: 2, max: 100, url: \"./img/blue.png\", anchor: {x: 16, y: 16}},\n          {min: 100, max: 1000, url: \"./img/yellow.png\", anchor: {x: 16, y: 16}},\n          {min: 1000, max: 2000, url: \"./img/purple.png\", anchor: {x: 24, y: 24}},\n          {min: 2000, url: \"./img/red.png\",anchor: {x: 32,y: 32}},\n      ]\n    }, function (markerCluster) {\n\n        //-----------------------------------------------------------------------\n        // Display the resolution (in order to understand the marker cluster)\n        //-----------------------------------------------------------------------\n        markerCluster.on(\"resolution_changed\", function (prev, newResolution) {\n            var self = this;\n            label.innerHTML = \"\u003cb\u003ezoom = \" + self.get(\"zoom\") + \", resolution = \" + self.get(\"resolution\") + \"\u003c/b\u003e\";\n        });\n        markerCluster.trigger(\"resolution_changed\");\n\n\n\n        //----------------------------------------------------------------------\n        // Remove the marker cluster\n        // (Don't remove/add repeatedly. This is really bad performance)\n        //----------------------------------------------------------------------\n        var removeBtn = document.getElementById(\"removeClusterBtn\");\n        removeBtn.addEventListener(\"click\", function() {\n          markerCluster.remove();\n        }, {\n          once: true\n        });\n\n        //------------------------------------\n        // If you tap on a marker,\n        // you can get the marker instnace.\n        // Then you can do what ever you want.\n        //------------------------------------\n        var htmlInfoWnd = new plugin.google.maps.HtmlInfoWindow();\n        markerCluster.on(plugin.google.maps.event.MARKER_CLICK, function (position, marker) {\n          var html = [\n            \"\u003cdiv style='width:250px;min-height:100px'\u003e\",\n            \"\u003cimg src='img/starbucks_logo.gif' align='right'\u003e\",\n            \"\u003cstrong\u003e\" + (marker.get(\"title\") || marker.get(\"name\")) + \"\u003c/strong\u003e\"\n          ];\n          if (marker.get(\"address\")) {\n            html.push(\"\u003cdiv style='font-size:0.8em;'\u003e\" + marker.get(\"address\") + \"\u003c/div\u003e\");\n          }\n          if (marker.get(\"phone\")) {\n            html.push(\"\u003ca href='tel:\" + marker.get(\"phone\") + \"' style='font-size:0.8em;color:blue;'\u003eTel: \" + marker.get(\"phone\") + \"\u003c/div\u003e\");\n          }\n          html.push(\"\u003c/div\u003e\");\n          htmlInfoWnd.setContent(html.join(\"\"));\n          htmlInfoWnd.open(marker);\n        });\n\n\n    });\n\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapsplugin%2Fmarker_cluster_demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmapsplugin%2Fmarker_cluster_demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapsplugin%2Fmarker_cluster_demo/lists"}