Japan Clickable Map
Place an interactive, clickable SVG map of Japan's 47 prefectures with a shortcode or block.
Install in
Japan Clickable Map turns a plain map of Japan into a navigation element: an
interactive SVG map with 47 clickable prefectures. You build a map in the
WordPress admin — pick which prefectures to show, give them colors and link
targets per prefecture or region — and then place it in any post, page or
custom post type with a shortcode or a block.
The map is rendered as inline SVG on the server. There is no external map
service, no API key and no JavaScript library to load: the front end only ships
a small script when a region popover is actually used.
Building a map
- Map range — show all 47 prefectures (
full), or only the prefectures you
pick (range). Any combination of prefectures is allowed. - Detail level — choose between
low,low-smooth,midandhighoutline
accuracy, so you can trade file size for coastline detail.low-smoothkeeps the
simplifiedlowoutline but joins its points with curves for a softer coastline. - Insets — Okinawa, the Northern Territories and the Ogasawara Islands are
placed at fixed positions inside the map frame instead of stretching it. - Grouping (full mode) — treat each prefecture as its own clickable area, or
group prefectures into regions. Regions can follow Japan’s standard eight
regions (Hokkaido, Tohoku, Kanto, Chubu, Kinki, Chugoku, Shikoku, Kyushu), or
you can define your own grouping per map. - Region behavior — a region can link straight to a URL, or open a popover
listing the destinations inside it (hover or click). - Colors — set a default fill for the map and override it per prefecture.
- Links — set a link per prefecture or per region. A prefecture with no link
is not clickable and does not change the cursor. - Link targets — enter a URL by hand, or search your site and pick a post,
page, custom post type entry or taxonomy term, so links keep working when
permalinks change. - Labels — prefecture and region names are drawn on the map and exposed to
screen readers asaria-label. Any label can be overridden per prefecture. - Legend — show a legend of your areas below the map. With “By region” it
lists the regions or your custom areas. In the other modes you define areas
on the “Legend areas” tab, and each area also colors its prefectures and
links them to the area’s URL. - Pins — mark places such as shops or offices with pins that carry an
optional label and link. Place a pin by clicking the map in the preview, or
type its coordinates. One pin image is shared by all maps: a default is
bundled, and you can choose your own under Settings. - Color presets — save the palettes you use often and reuse them across
maps. - Preview — check the finished map in a modal without leaving the editor.
Placing a map
Shortcode:
[plg_jcm_map id="123"]
Optional attributes: level (low / low-smooth / mid / high) to override
the detail level saved on the map, and class to add your own CSS class.
Or insert the Clickable Map of Japan block and choose which map to display. The
block stores only the map ID and renders on the server, so editing a map updates
every place it is embedded.
Prefecture level, without limits
Every option above is available here, and you can create as many prefecture maps
as you like. What the paid edition adds is a different level of detail:
maps at municipality level, where the clickable areas are cities, towns and
wards rather than prefectures, and where those areas can be grouped across
prefecture borders.
For developers
Themes and other plugins can change a map through 8 hooks. Every name starts
with plg_jcm_, and the paid edition uses the same names and arguments.
plg_jcm_loaded(action) — the plugin has loaded and set itself up.plg_jcm_config(filter) — a map’s saved settings, before it is rendered on the site.plg_jcm_allowed_levels(filter) — the detail levels a map may use.plg_jcm_svg_file(filter) — the path of the base SVG map for a detail level.plg_jcm_pref_path_attrs(filter) — the fill color, accessible name and link of one prefecture.plg_jcm_svg_dom(action) — the finished SVG as aDOMDocument, just before it is output.plg_jcm_allowed_html(filter) — thewp_ksesallowlist for the map SVG.plg_jcm_map_html(filter) — the final HTML of the shortcode or block.
If you add elements in plg_jcm_svg_dom, allow them in plg_jcm_allowed_html
too: anything that is not on the allowlist is removed from the output. Where a
hook passes $kind, it is always pref here; the paid edition also passes
muni for municipality maps. Documentation: https://plugear.net/docs/japan-clickable-map/en/
Map data
The bundled SVG maps in assets/svg/ are derived from the National Land
Numerical Information (Administrative Zones Data, N03) published by the
Ministry of Land, Infrastructure, Transport and Tourism of Japan (data as of
1 January 2024).
- Source: https://nlftp.mlit.go.jp/ksj/gml/datalist/KsjTmplt-N03-v3_1.html
- Terms: https://nlftp.mlit.go.jp/ksj/other/agreement_01.html — the Japanese
Government Standard Terms of Use (version 2.0), which are compatible with
CC BY 4.0. Modification, redistribution and commercial use are permitted as
long as the source is credited.
Processing applied to the original data: administrative polygons dissolved into
prefecture outlines, reprojection to Web Mercator (EPSG:3857), Okinawa moved
into an inset, vertex simplification, conversion to SVG, and the addition of
identifying attributes. See assets/svg/japan/README.md for details.
If you display these maps, please credit the source somewhere visible on the
page (a footer or a caption is fine):
「国土数値情報(行政区域データ)」(国土交通省)
(https://nlftp.mlit.go.jp/ksj/gml/datalist/KsjTmplt-N03-v3_1.html) を加工して作成
Written by Joobi from the project's own listing. See the source page
1.1.0
- Added: a legend below the map. With “By region” it lists the regions or your
custom areas; in the other modes it lists the areas you define on the new
“Legend areas” tab. A legend area also colors its prefectures and links them
to the area’s URL. - Added: pins with an optional label and link, placed by clicking the preview.
All maps share one pin image (a default is bundled), which you can change
under Settings. - Added: 8 hooks for developers. See “For developers” in the description.
- Fixed: a map link no longer keeps a focus outline after a mouse click.
Keyboard focus is still shown. - Fixed: a theme’s letter-spacing no longer stretches or squeezes the names
drawn on the map. - Fixed: the “Clear” button next to the color presets did nothing on a custom
area added before the map was saved. - Changed: saving a map in this edition no longer drops the legend and pin
settings made in the paid edition. - Existing maps look the same until you turn the new features on.
1.0.1
- Fixed: parts of the admin UI were shown in Japanese regardless of the site
language. The preview button and modal, the region popover close button, the
selected-prefecture counter, the unassigned list and the color preset controls
are now translatable. - Fixed: the prefecture counter next to each region heading was blank on
non-Japanese sites. - Fixed: the selected-prefecture counter switched language as soon as you ticked
a checkbox, because the initial value and the live update came from different
places. - Changed:
Plugin URInow points at the English documentation. - Docs: corrected the installation steps (there is no shortcode to copy on the
edit screen — the map ID is thepost=value in the edit screen URL) and the
list of detail levels (low-smoothwas missing).
1.0.0
- First release.
Follow this listing's changes (Atom feed)