Skip to content

Instantly share code, notes, and snippets.

Avatar

Carlos Moreira carmoreira

View GitHub Profile
@carmoreira
carmoreira / drilldownzoom.js
Created June 9, 2022 13:12
Show all overlay series after specific zoom level - Interactive Geo Maps
View drilldownzoom.js
let igmNow = Date.now();
let igmZoomLevel = 3;
mapContainer.addEventListener('mapready', function(ev) {
let igmap = iMaps.maps[mapID].map;
igmap.events.on("zoomlevelchanged", function(ev) {
if( Date.now() >= igmNow + 500){
let series = iMaps.maps[mapID].series;
series.forEach(function(serie) {
if( iMaps.maps[mapID].allBaseSeries.includes( serie ) ){ return; }
if (igmap.zoomLevel >= igmZoomLevel) {
@carmoreira
carmoreira / specificMap.js
Created June 6, 2022 18:37
Display specific map after region is clicked based on region.value parameter - Interactive Geo Maps
View specificMap.js
// replace with your map ID and region code.
let mapID=3492193;
let mapContainer=document.getElementById('map_' + mapID);
mapContainer.addEventListener('mapready', function(ev) {
iMaps.maps[mapID].series[0].mapPolygons.each(function(region) {
region.events.on("hit", function(ev) {
let data=ev.target.dataItem.dataContext;
let drillTo=parseInt(data.value);
if (Array.isArray(iMapsManager.maps[mapID].seriesById[drillTo])) {
@carmoreira
carmoreira / WorldUSA.geojson
Created May 10, 2022 12:37
World map with USA divided by states - Compatible with Interactive Geo Maps WP Plugin
View WorldUSA.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@carmoreira
carmoreira / style.css
Created May 3, 2022 14:03
Interactive Geo Maps - Choices Dropdown, change list width
View style.css
.map_wrapper .choices__list--dropdown .choices__list {
max-height:200px !important;
}
@carmoreira
carmoreira / canarias.json
Created April 24, 2022 18:36
Canarias Spain Municipios GeoJSON file for Interactive Geo Maps
View canarias.json
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@carmoreira
carmoreira / australia.geojson
Created April 22, 2022 13:23
Australia geojson more detailed - Interactive Geo Maps
View australia.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@carmoreira
carmoreira / kenya.geojson
Created April 22, 2022 09:50
Kenya Constituencies geojson simplified - Interactive Geo Maps
View kenya.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@carmoreira
carmoreira / animate.css
Created April 14, 2022 15:39
Animate markers when they have specific colours - can be used to target hover colours - Interactive Geo Maps
View animate.css
/* For color #dd3333 */
.imapsCircle-group[fill="#dd3333"] .imapsCircle {
paint-order: stroke;
stroke: #dd3333;
stroke-opacity:0;
stroke-width:15px;
transition: stroke-opacity 0.5s, stroke-width 0.2s;
}
/* For color #2ca25f */
@carmoreira
carmoreira / show.js
Last active May 15, 2022 16:32
Show all marker series in map, if drilldown is enabled - Interactive Geo Maps
View show.js
// added this control check, in case code was added more than once
if (typeof mapCode === 'undefined') {
let mapID = 159; // CHANGE MAP ID HERE
let mapContainer = document.getElementById('map_' + mapID);
mapContainer.addEventListener('mapready', function(ev) {
iMaps.maps[mapID].series.forEach(function(serie) {
if (serie.className === 'MapImageSeries') {
serie.show();
}
});
@carmoreira
carmoreira / reset.js
Last active May 16, 2022 13:51
Interactive Geo Maps - Add reset link to content that display below/side
View reset.js
jQuery('.igm-map-content').each(function() {
var button = jQuery('<a>Close</a>');
button.on('click', function() {
var mapID = 3492169; // replace with your map ID
iMapsManager.clearSelected(mapID);
iMapsActions.resetActions(mapID);
});
jQuery(this).prepend(button);
});