Skip to content

Instantly share code, notes, and snippets.

View rveciana's full-sized avatar
🐢

Roger Veciana i Rovira rveciana

🐢
View GitHub Profile
@rveciana
rveciana / .block
Last active February 8, 2019 13:45
Cloud Optimized Geotiff example 2
license: gpl-3.0
@rveciana
rveciana / .block
Last active December 20, 2021 02:51
Cloud Optimized Geotiff example 1
license: gpl-3.0
@rveciana
rveciana / .block
Last active November 8, 2018 07:17 — forked from mbostock/.block
Armadillo projection with New Zealand
license: gpl-3.0
@rveciana
rveciana / README.md
Last active January 17, 2023 00:15
Turf multiline and polygon intersection

The previous example showed how to intersect a line with a polygon, but the situations can be more complicated, as shown in this example.

The solution is using the lineSplit function for each part of the multilinestring and selecting the ones that fit the needs. The first part can be inside or outside the polygon, depending on the first point. Detecting this, is easy to get only the needed parts.

@rveciana
rveciana / README.md
Last active April 2, 2023 20:23 — forked from danswick/index.html
Using Turf to measure how far a line travels through a polygon in modern turf.js

Example to ilustrate this question at gis.stackoverflow.

The solution is using a combination of lineIntersect and lineSlice. The first one gives the points where the line and the polygon intersect. The second takes the part of the polyline btween the two points.

If the result is more complex (i.e. the resulting intersection is a polyline), the algorithm should be repeated for each part in the polygon.

@rveciana
rveciana / .block
Last active February 17, 2018 16:43
Inverse of the distance with gpu.js
licence: mit
@rveciana
rveciana / .block
Last active September 19, 2023 11:40
Basic gpu.js canvas example
licence: mit
@rveciana
rveciana / .block
Last active January 29, 2018 09:52
d3CompositeProjections using the new d3js v5
licence: mit
@rveciana
rveciana / .block
Last active September 13, 2019 10:25
Coastal Vignette with D3js
licence: mit
@rveciana
rveciana / README.md
Last active October 24, 2017 21:04
Checking a retina display map

This is an example from the post Canvas mapping with a retina display.

The upper part of the map is not corrected for retins displays and will appear blurred in them, and the lower part is corrected and should appear with sharp edges.

See the post to learn how to simulate the retina display if your device doesn't have it.