Skip to content

Instantly share code, notes, and snippets.

View carmoreira's full-sized avatar

Carlos Moreira carmoreira

View GitHub Profile
@carmoreira
carmoreira / pan.js
Last active June 22, 2022 09:01
Interactive Geo Maps - Remove Pan out limit - allow map to be dragged beyond the limits
// replace with your map ID.
let mapID = 877;
let mapContainer = document.getElementById('map_' + mapID);
mapContainer.addEventListener('mapready',function(ev){
iMaps.maps[mapID].map.maxPanOut = 10;
});
@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
Loading
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
Loading
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
Loading
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.