Giter VIP home page Giter VIP logo

Comments (7)

BNNorman avatar BNNorman commented on June 25, 2024 1

Beta and live maps work for me

from air-quality-web.

sbrl avatar sbrl commented on June 25, 2024

Fixed! Now I just need to deploy it.

from air-quality-web.

sbrl avatar sbrl commented on June 25, 2024

The fix should be deployed to the beta version, @bsimmo. Perhaps you could test it and confirm that it's fixed?

from air-quality-web.

bsimmo avatar bsimmo commented on June 25, 2024

from air-quality-web.

BNNorman avatar BNNorman commented on June 25, 2024

And me - live map is still there

from air-quality-web.

sbrl avatar sbrl commented on June 25, 2024

Ack! It shouldn't have done that. It should be fixed now @BNNorman @bsimmo

from air-quality-web.

bsimmo avatar bsimmo commented on June 25, 2024

Site is working, but the API list-devices-near is not quite working.

If I asked for 3 locations, I would get three before (as intended)
Now I just get the same one (nearest) three times.

Example Python3 code

import json
from urllib import request, parse

api_url = "http://sensors.connectedhumber.org/beta/api.php?action="

no_of_locations = 3
my_location = ( 53.750, -0.395 )

def get_nearest_sensors( my_location, no_of_locations ):
    url = str( api_url ) + "list-devices-near&count=" + str( no_of_locations )
    data = parse.urlencode( {'latitude': my_location[0], 'longitude': my_location[1]} ).encode()
    req = request.Request( url, data=data )
    response = request.urlopen( req )
    return response

# ------- #
nearest_sensors = json.loads( get_nearest_sensors( my_location, no_of_locations ).read().decode('utf-8') )
print( nearest_sensors )
    
for line in nearest_sensors:
    print( line['id'], line['name'], "is", round( line['distance_actual']*0.000621, 1), "miles away" )
print("----------")

Currently returns

[{'id': 36, 'name': 'CHASW-24AD43-1', 'latitude': 53.75642593, 'longitude': -0.36844245, 'distance_calc': 1886.588853560329, 'last_seen': '2020-03-08 21:32:06', 'distance_actual': 1892.19}, {'id': 36, 'name': 'CHASW-24AD43-1', 'latitude': 53.75642593, 'longitude': -0.36844245, 'distance_calc': 1886.588853560329, 'last_seen': '2020-03-08 21:32:06', 'distance_actual': 1892.19}, {'id': 36, 'name': 'CHASW-24AD43-1', 'latitude': 53.75642593, 'longitude': -0.36844245, 'distance_calc': 1886.588853560329, 'last_seen': '2020-03-08 21:32:06', 'distance_actual': 1892.19}]
36 CHASW-24AD43-1 is 1.2 miles away
36 CHASW-24AD43-1 is 1.2 miles away
36 CHASW-24AD43-1 is 1.2 miles away

Also as an aside, I thought
'distance_calc': 1886.588853560329
field was being removed as 'distance_actual' is the correct geodesic distance.

from air-quality-web.

Related Issues (20)

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.