Browse Source

add README for geo-picking tools

Gregg Tavares 6 years ago
parent
commit
e4511f940f

+ 27 - 0
threejs/lessons/tools/geo-picking/README.md

@@ -0,0 +1,27 @@
+# Geo Picking Data
+
+These tools were used to generate data for both
+[the article on aligning HTML elements to 3D](https://threejsfundamentals.org/threejs/lessons/threejs-align-html-elements-to-3d.html)
+and [the article on using indexed textures for picking and color](https://threejsfundamentals.org/threejs/lessons/threejs-indexed-textures.html)
+
+I'm not going to go into details on how they work but you can look inside
+and see them draw the images and extract the data. Maybe you can use them
+to make or extract similar maps from other data.
+
+The one I actually used is `make-geo-picking-texture.html`. To run it you need
+to download the data from [here](http://thematicmapping.org/downloads/world_borders.php)
+then unzip it and put it in this folder.
+
+Then run a simple server. If you don't already know how to do that [here's a simple one](https://greggman.github.io/servez/)
+that will take just a few clicks to use. Run it, point it at this folder, then load `make-geo-picking-texture.html`
+in your browser.
+
+There's also another one called `make-geo-picking-texture-ogc.html`. It works with data from
+[here](https://gadm.org/download_world.html). To use that one download the database then use
+a tool like [https://sqlitebrowser.org/](https://sqlitebrowser.org/). Open the database and
+export the table called `level1` to a json file called `level1.json`
+
+Then run a simple server like above and open `make-geo-picking-texture-ogc.html` in your browser.
+
+
+

+ 1 - 2
threejs/lessons/tools/geo-picking/make-geo-picking-texture-ogc.html

@@ -107,8 +107,7 @@ async function main() {
 
   const colors = {};
 
-  //const req = await fetch('level1.json');
-  const req = await fetch('foo.json');
+  const req = await fetch('level1.json');
   const areas = await req.json();
   let min = [Number.MAX_VALUE, Number.MAX_VALUE];
   let max = [Number.MIN_VALUE, Number.MIN_VALUE];

+ 0 - 0
threejs/lessons/tools/ogc-parser.js → threejs/lessons/tools/geo-picking/ogc-parser.js