Skip to content

Instantly share code, notes, and snippets.

@carmoreira
carmoreira / reset.js
Created June 17, 2022 09:09
Interactive Geo Maps - Reset actions after menu filter dropdown changes
// replace 55677 with your map ID
document.addEventListener('input', function (event) {
if (event.target.id !== 'igm-live-filter-55677') return;
iMapsActions.resetActions(55677);
});
@carmoreira
carmoreira / igm-custom-solution.php
Created June 16, 2022 16:03
Interactive Geo Maps - Custom Solution to read from custom meta fields
<?php
/**
* Interactive Geo Maps Custom Solution
*
* @wordpress-plugin
* Plugin Name: Interactive Geo Maps Custom Solution
* Plugin URI: https://interactivegeomaps.com
* Description: Reads from custom meta fields
* Version: 1.0.0
* Author: Carlos Moreira
@carmoreira
carmoreira / drilldownzoom.js
Last active August 3, 2023 17:00
Show all overlay series after specific zoom level - Interactive Geo Maps
let mapID = 11111; // replace with your map ID
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; }
@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
// 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
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
.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
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
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
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
/* 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 */