Code Monkey home page Code Monkey logo

datasette-enrichments-gmap-elevation's Issues

datasette secrets imcompatible with older datasette versions

Arrived at this issue

ImportError while importing test module 'C:\Users\m3n7es\source\datasette-enrichments-gmap-elevation\tests\test_elev_parse_args.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\Lib\importlib\__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests\test_elev_parse_args.py:2: in <module>
    from datasette_enrichments_gmap_elevation import get_template_args
datasette_enrichments_gmap_elevation\__init__.py:7: in <module>
    from datasette_enrichments import Enrichment
venv\Lib\site-packages\datasette_enrichments\__init__.py:5: in <module>
    from datasette_secrets import Secret, get_secret
venv\Lib\site-packages\datasette_secrets\__init__.py:5: in <module>
    from datasette.plugins import pm
venv\Lib\site-packages\datasette\plugins.py:27: in <module>
    pm.load_setuptools_entrypoints("datasette")
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\Lib\importlib\metadata\__init__.py:202: in load
    module = import_module(match.group('module'))
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\Lib\importlib\__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
E   ModuleNotFoundError: No module named 'datasette_gis_partial_path_lat'

I'm not controlling the version of datasette I require:

dependencies = [
    "datasette",
    "datasette-enrichments>=0.2",
    "sqlite-utils",
    "datasette-gis-partial-path",
]

As can be seen above, I am controlling the version of enrichments for some reason. I'll try removing that control. Current release is 0.4.2

Implement json only output; modify input format

The enrichment should accept the following input template

{{rx_lat},{{rx_lng}},{{tx_lat}},{tx_lng}},{{optional_path_length_meters}}

It should store the returned Google Maps Elevation API json text in a column labeled 'json_elevation' like the following

image

Request for elevation along a path isn't working

Using the URL instructions at (or trying to) I get

{"results":[],"status":"INVALID_REQUEST"}

Using the documentation example:

https://maps.googleapis.com/maps/api/elevation/json?path=36.578581%2C-118.291994%7C36.23998%2C-116.83171&samples=3&key=YOUR_API_KEY

gives

{
   "results" : 
   [
      {
         "elevation" : 4411.94189453125,
         "location" : 
         {
            "lat" : 36.578581,
            "lng" : -118.291994
         },
         "resolution" : 19.08790397644043
      },
      {
         "elevation" : 1372.8359375,
         "location" : 
         {
            "lat" : 36.41150289067028,
            "lng" : -117.5602607523847
         },
         "resolution" : 9.543951988220215
      },
      {
         "elevation" : -84.51690673828125,
         "location" : 
         {
            "lat" : 36.23998,
            "lng" : -116.83171
         },
         "resolution" : 9.543951988220215
      }
   ],
   "status" : "OK"
}

What happens if I ask for 200 points along the path?
I get a lot of point!

So, that's good. Putting in the coordinate for my 200 meter path gives
(Putting them in one at a time...)
First point is good with second example point.
Second point also worked, so it will be time to crack out jq in a minute, but still... What was the issue?
Comparing the addresses:
My original
https://maps.googleapis.com/maps/api/elevation/json?path=37.72489522009444%2C-122.42293617440532%7C37.72472947037526%2C-122.42072468451954&samples=200
https://maps.googleapis.com/maps/api/elevation/json?path=37.72489522009444%2C-122.42293617440532%7C37.72472947037526%2C-122.42072468451954&samples=200
The one that worked is above

Make experimental chart of returned elevation values

Done! (Look towards the bottom of the sheet for the chart.

Here's the jq filter for the results:
.results[].elevation
Google Earth:
image

Sheets graph:
image

Request URL minus key:
https://maps.googleapis.com/maps/api/elevation/json?path=37.72489522009444%2C-122.42293617440532%7C37.72472947037526%2C-122.42072468451954&samples=200&key=

Automate this a bit more by providing csv with indexes corresponding to meters.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.