Skip to content

Instantly share code, notes, and snippets.

View hugolpz's full-sized avatar
🎯
Focusing

Lopez Hugo hugolpz

🎯
Focusing
View GitHub Profile
@hugolpz
hugolpz / README.md
Last active August 29, 2015 13:55 — forked from mbostock/.block
@hugolpz
hugolpz / README.md
Last active August 29, 2015 14:00 — forked from pnavarrc/README.md
Automatic Label Placement

By Navarro. See also: D3js: Automatic labels placement to avoid overlaps? (force repulsion)

This example is an extension of Mike Bostock’s tutorial Lets Make a Map that implements automatic label placement using the force layout and multiple foci. The centroid of each feature will define a foci of the force. This foci will attract the label that correspond to that feature (and ignore the others). The labels will repel themselves to avoid overlapping.

References

@hugolpz
hugolpz / README.md
Last active August 29, 2015 14:00 — forked from mjhoy/Makefile
Wikimaps Atlas : Shaded relief v.05/03

6 Shaded Reliefs

Action: When run, this country.makefile [download][1] the raster GIS DEM sources, process them (unzip, crop, shaded relief, resize, colorize), to output 6 elegant shaded reliefs. Can work for any country or area, given you provide WNES (West/North/East/South) geocoordinates, in decimal degrees.

Output:

  • 2 hillshades:
  • hillshade_grey (GIS tif)
  • hillshade_trans (png)
  • 1 color-relief (wikipedia style):
@hugolpz
hugolpz / .gitignore
Last active August 29, 2015 14:01 — forked from mbostock/.block
Choropleth with makefile
.DS_Store
build
node_modules
@hugolpz
hugolpz / README.md
Last active August 29, 2015 14:01 — forked from mbostock/.block
Choropleth w. threshold scale

By mbostock. Forked for later adaptation.

This choropleth uses a threshold scale for quantization, mapping arbitrary slices of a continuous domain to discrete values in the range. Unemployment rates ranging from 2 to 10% are quantized into different shades of purple.

var color = d3.scale.threshold()
    .domain([.02, .04, .06, .08, .10])
    .range(["#f2f0f7", "#dadaeb", "#bcbddc", "#9e9ac8", "#756bb1", "#54278f"]);
@hugolpz
hugolpz / README.md
Last active August 29, 2015 14:01 — forked from mbostock/.block
ColorBrewer2.org - color advices for cartography

[By Mike Bostock, for later reuse.]

A quick visual reference to every ColorBrewer scale; colors by Cynthia Brewer. Available in CSS and JS format. Click on a palette to log the constituent colors in hexadecimal RGB to the console.

@hugolpz
hugolpz / README.md
Last active August 29, 2015 14:01 — forked from mjhoy/README.md
Raster clipping via D3js

Shown is Lake Superior and the surrounding terrain, using data from NASA’s Shuttle Radar Topography Mission and [bathymetry data from NOAA][noaa].

The two images are layered using a clipping path of the lake, from Natural Earth’s 10m vector lake dataset.

Hill relief, as usual, was generated using the gdal utility suite.

@hugolpz
hugolpz / README.md
Last active August 29, 2015 14:05
Wikiatlas Localisator using D3.geo

A complete, automatic and flexible orthographic localisator for Wikipedia maps.

var bb = { "item":"India", "W": 67.0, "N":37.5, "E": 99.0, "S": 5.0 }, 
localisator("body", 200, bb.item, bb.W, bb.N, bb.E, bb.S);

It take as input :

  • a JS selector: a target html element's selector such as "body", "#hook", to be appended to,
@hugolpz
hugolpz / README.md
Last active August 29, 2015 14:05
WikiAtlas ramp (beta)

This gist is a starting point to code a function buiding wikiatlas keys. It also gather helpful resources to learn and code further. Collaborative and versionned coding, fork, can be done on Codio.

We dream of...

Ideally, the function should take as input :

  • the range [zmin, zmax] (?),
  • an array for positives values [0, 50 200, 500, <zmax>],
  • an array for negative values [, -200, -100, -50, 0]
@hugolpz
hugolpz / README.md
Last active August 29, 2015 14:05 — forked from emeeks/README.md
D3-svg-legend (test)

d3.svg.legend provides for a simple legend that can be displayed horizontally or vertically and accepts a few different d3 scale types.