ChHarding / TouchTerrain_for_CAGEO

Touch Terrain: A python app to create 3D printable terrain models (STL/OBJ) from only elevation data (via Google Earth Engine) or from a local geotiff. Has been used for CNC terrain models. Runs as a web app (http://touchterrain.org), as .py file (standalone.py) or as jupyter notebook. Docker image: https://github.com/ChHarding/TouchTerrain_jupyter_docker
http://touchterrain.geol.iastate.edu
191 stars 44 forks source link

Type in Coordinates #21

Closed DakotaWray2 closed 3 years ago

DakotaWray2 commented 4 years ago

I would like the ability to type in coordinates for fine-tuning rather than rely on the dragging the box on the map. I will try to implement when I have time and create a pull request. Thanks!

ChHarding commented 4 years ago

Great, thanks for the offer. I’ve thought about this a bit and there was something in the way it’s now implemented that gave me pause, but now I forgot what that was. Also be aware that this was literally my first multi page piece of JS code and it's probably very “nooby”, so eyeroll/facepalm warning :). It probably reads more like C than actual JS … I still want to keep is as pure JS as possible but I’m aware that many things could be improved anyway.

Looking at the code now (after 3 years), I think the 4 text boxes trlat2, etc. would need to be set to not readonly and have a callback when enter was pressed, either 4 separate callbacks or one that’s fired if one or more of the 4 have been changed. Or, instead of enter callbacks something like a loose focus callback?

 <!-- Put the box corner coords here so they get transmitted with get -->
     <input type="text" id="trlat2" name="trlat" maxlength="7" size="7" value="NULL" title="(trlat)" readonly> N
     <input type="text" id="trlon2" name="trlon" maxlength="8" size="8" value="NULL" title="(trlon)" readonly> E (Top right corner)<br>

     <input type="text" id="bllat2" name="bllat" maxlength="7" size="7" value="NULL" title="(bllat)" readonly> N
     <input type="text" id="bllon2" name="bllon" maxlength="8" size="8" value="NULL" title="(bllon)" readonly> E (Lower left corner) <br>
     <br>

In each of those callbacks, the appropriate side of the bounds of the global rectangle has to be changed, similar to this but with set instead of get:

  let b = rectangle.getBounds();
  let trlat = b.getNorthEast().lat();
  let trlon = b.getNorthEast().lng();
  let bllat = b.getSouthWest().lat();
  let bllon = b.getSouthWest().lng();

If you ever get started on this and need help, please ping me!

Cheers

Chris

On Oct 18, 2019, at 21:28, Dakota Wray notifications@github.com wrote:

I would like the ability to type in coordinates for fine-tuning rather than rely on the dragging the box on the map. I will try to implement when I have time and create a pull request. Thanks!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ChHarding/TouchTerrain_for_CAGEO/issues/21?email_source=notifications&email_token=AEYDF5O22ITHAXNA4HD5Z2TQPJWFTA5CNFSM4JCNZ3D2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HS4QPPQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEYDF5JYXSFPQF6TBXK5SJ3QPJWFTANCNFSM4JCNZ3DQ.

Chris Harding Associate Professor Department of Geological & Atmospheric Sciences

TouchTerrain.geol.iastate.edu

ChHarding commented 4 years ago

BTW (just thought of this now ...) you can sort of type in your coordinates: 1) position the red box roughly where you want it 2) in the box for manual settings, overwrite the coordinates for the box corners, eg. "trlat":44.5, "trlon":-101.5, "bllat":37.1, "bllon":-111 tr = top right, bl = bottom left corner 3) the red box won't visually move to these overwrite coordinates but they will be used for processing!

Let me know if that works for you!

ChHarding commented 3 years ago

This has been added to version 3.0