Live data from Hacker News

I built a vector map from scratch

ckochis.com

1–10 of 43 posts

I built a vector map from scratch

#1
Hi HN

I've used a lot of vector maps in the past, and was always fascinated by the technology, so I decided to try and build one from scratch as a way to learn more about how it works, and also as a reason to (finally) learn WebGL.

I've uploaded the source to GitHub https://github.com/kochis/webgl-map

Hope someone finds it useful / informative, and open to any feedback or tips as well. Cheers!

I built a vector map from scratch
ckochis.com

Re: I built a vector map from scratch

#3
Fantastic post, such a wonderful step by step guide!

Although everything loaded and “worked” on mobile (I’m using iOS), two small interaction hiccups would be great to solve:

- when panning (on mobile), the panned distance seemed to track the finger’s movement with some factor i.e. when moving “1 cm” of “finger space” (i.e. real world movement), the map moved by more than “1 cm”. (Sorry for the weird units, ha)

- the common pinch zoom gesture is either being detected as something else or just not working? I was able to zoom, somehow, but not in any controlled way

These don’t take anything away from the tutorial! I think that fixing these would make the learning/demo experience even smoother, that’s all.

I may give it a stab since you shared the code :) Cheers

---

Opened an issue to track this: https://github.com/kochis/webgl-map/issues/1

Re: I built a vector map from scratch

#4

Fantastic post, such a wonderful step by step guide! Although everything loaded and “worked” on mobile (I’m using iOS), two small interaction hiccups would be great to solve: - when panning (on mobile), the panned distance seemed to track the finger’s movement with some factor i.e. when moving “1 cm” of “finger space” (i.e. real world movement), the map moved by more than “1 cm”. (Sorry for the weird units, ha) - the…

Yeah, I think this is a known issue with hammer.js[1]. I noticed it too, but didn't spend too much time digging in.

[1]: https://stackoverflow.com/questions/42872774/hammer-js-exhib...

Re: I built a vector map from scratch

#6
I've been working with maps/mapbox for like 10 years, and knew of webgl and used libraries that used it but never myself. I've never dug into this level of detail for rendering. It's been a while since I've seen such a high-effort post on HN, thanks for this, it's great.

Re: I built a vector map from scratch

#7
post #5

This is great. I was thinking about doing something like this recently; however, I was considering WebGPU. Did you give any consideration to WebGL vs WebGPU for this purpose?

Mostly just because I was using https://webglfundamentals.org/ as my main resource. Will probably take a stab at implementing with WebGPU at some point.

Re: I built a vector map from scratch

#9
post #8

The tile server appears to be toast.

Ah, was afraid that might happen. I’m doing some pretty aggressive CF caching, but it’s running on a very small (single instance) server :(

—- update

Looks like I hit the CF worker limit. Should be back up and running. Thanks for the heads up!

Post reply on HN