Skip to content

Instantly share code, notes, and snippets.

Avatar

Carlos Moreira carmoreira

View GitHub Profile
@carmoreira
carmoreira / kenya.geojson
Created Apr 22, 2022
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 Apr 14, 2022
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
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
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);
});
@carmoreira
carmoreira / style.css
Created Apr 8, 2022
Interactive Geo Maps - Make tooltip smaller on mobile
View style.css
@media only screen and (max-width:780px) {
.map_wrapper .imapsLabel foreignObject {
font-size:0.6em;
line-height:1.1em;
white-space:normal;
}
}
@carmoreira
carmoreira / france2015.geojson
Created Apr 1, 2022
France 2015 regions geojson file - compatible with Interactive Geo Maps WordPress plugin
View france2015.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@carmoreira
carmoreira / scroll.css
Created Mar 28, 2022
Scroll in tooltip overflow - Interactive Geo Maps
View scroll.css
.imapsTooltip foreignObject > div {
max-height:100px !important;
overflow:scroll !important;
}
@carmoreira
carmoreira / zoomLevel.js
Last active Mar 30, 2022
Hide marker auto labels until specific zoom level is reached - Interactive Geo Maps
View zoomLevel.js
let mapID = 3491853; // replace with your map ID
let zoomLevel = 8; // replace with the zoom level you want to show the labels at
let igmNow = Date.now();
function igmHideMarkers(igmap) {
igmNow = Date.now();
let series = iMaps.maps[mapID].series;
series.forEach(function(serie) {
if (typeof serie.mapImages === 'undefined') {
return;
@carmoreira
carmoreira / dropshadow.js
Created Mar 24, 2022
Adding drop shadow to grouped entries in Interactive Geo Maps
View dropshadow.js
let mapID = 21169; // change with your map ID
let mapContainer = document.getElementById('map_' + mapID);
if(mapContainer){
mapContainer.addEventListener('mapready',function(ev){
iMaps.maps[mapID].series.forEach(function(serie){
var filter = serie.filters.push(new am4core.DropShadowFilter());
filter.color = am4core.color("#000000");
filter.dx = 5;
filter.dy = 5;
filter.blur = 2;
@carmoreira
carmoreira / click.js
Created Mar 13, 2022
Interactive Geo Maps - Listen to zoom home button click event
View click.js
let mapID = '3491792'; //replace with your map ID
iMaps.maps[mapID].map.zoomControl.children._values[0].events.on('hit', function() {
//run your custom code here, it will be triggered when the home button is clicked.
});