Skip to main content
100%

[Working with spatial data](https://github.com/enjalot/wwsd)

✓ Published0🌍 Public
AAlan McConchie
Last edited Mar 25, 2018
Created on Mar 25, 2018

This example shows a world map with populated places as circles, highlighting countries and cities through mouse interaction. It loads GeoJSON data for country boundaries and populated places from external URLs, then renders them using SVG paths and circles. The code uses D3’s `d3.geo.mercator()` projection and `d3.geo.path()` for map shapes, while circles are positioned via the projection on coordinates. On mouseover, a circle enlarges from radius 5 to 10 and logs its data to the console; mouseout reverts the size. The map uses D3 v3 and TopoJSON, with active states styled via CSS classes.

AI-generated description

Working with spatial data

Example #7

Simple mouse interaction with d3.js

forked from <a href='http://bl.ocks.org/mbostock/'>mbostock</a>'s block: <a href='http://bl.ocks.org/mbostock/4122298'>U.S. Counties TopoJSON</a>

forked from <a href='http://bl.ocks.org/enjalot/'>enjalot</a>'s block: <a href='http://bl.ocks.org/enjalot/4a449bee40e7b74108de89e303a2a284'>WWSD #5: d3 + TopoJSON</a>

forked from <a href='http://bl.ocks.org/enjalot/'>enjalot</a>'s block: <a href='http://bl.ocks.org/enjalot/d355270ee9e979333040e1a46ff03fc6'>WWSD #7: d3 mouse interaction</a>

gpl-3.0 Licensed

Similar vizzes