Git Product home page Git Product logo

usgs-machine-to-machine-api's People

Contributors

akshathraghav avatar jacobwhall avatar mrchebur avatar shevfa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

usgs-machine-to-machine-api's Issues

Help downloading surface reflectance NDVI

@MrChebur we are trying to download NDVI data from ROI below. Could you help us because we couldn't get to understand how to deal with the API.

    ROIf = [[
    [35.3331, -107.8033 ],
    [35.3331,  -110.9702],
    [33.6878,   -110.9702],
    [33.6878,  -107.8033],
    ]]

Also for the API (v1.5.0), could you probably provide more details about the available options for the parameter.
For example the datasetName or filterType. I was expecting to use the EarthExplore to search for the data and get these details but that seems to provide no help.

UsageExample.py does not seem to work

I am trying to download some NDVI data from USGS using the API but there seems to be a problem

!) Running the UsageExample.py seems to fail with error

3.8/bin/python /Users/henrysenyondo
/Downloads/usgs-machine-to-machine-API/UsageExample.py
Your login permissions is ['download', 'order']


Downloading:
The file size of LandsatLook Quality Image with entityId=LC81590152020212LGN00 is 2963678 bytes

Traceback (most recent call last):
  File "/Users/henrysenyondo/Downloads/usgs-machine-to-machine-API/UsageExample.py", line 108, in <module>
    main()
  File "/Users/henrysenyondo/Downloads/usgs-machine-to-machine-API/UsageExample.py", line 99, in main
    results = otherMethods.download(api, datasetName=datasetName, entityIds=entityId, productName=productName,
TypeError: download() got an unexpected keyword argument 'entityIds'
  1. Trying to search for all Landsat datasets LANDSAT_8 instead of LANDSAT_8_C1 fails
#datasetName = 'LANDSAT_8_C1' 
   datasetName = 'LANDSAT_8'
3.8/bin/python /Users/henrysenyondo
/Downloads/usgs-machine-to-machine-API/UsageExample.py
Your login permissions is ['download', 'order']

{'requestId': 709498086, 'version': 'stable', 'sessionId': 133247086, 'data': None, 'errorCode': 'DATASET_INVALID', 'errorMessage': 'An invalid dataset has been provided'}
Traceback (most recent call last):
  File "/Users/henrysenyondo/Downloads/usgs-machine-to-machine-API/UsageExample.py", line 108, in <module>
    main()
  File "/Users/henrysenyondo/Downloads/usgs-machine-to-machine-API/UsageExample.py", line 78, in main
    sceneSearchResult = api.sceneSearch(datasetName=datasetName, maxResults=1, startingNumber=None,
  File "/Users/henrysenyondo/Downloads/usgs-machine-to-machine-API/usgsMethods.py", line 759, in sceneSearch
    _check_response(response)
  File "/Users/henrysenyondo/Downloads/usgs-machine-to-machine-API/checkResponse.py", line 7, in _check_response
    _check_usgs_error(response)
  File "/Users/henrysenyondo/Downloads/usgs-machine-to-machine-API/checkResponse.py", line 94, in _check_usgs_error
    raise usgsErrors.DATASET_INVALID(f'{errorCode}: {errorMessage}')
usgsErrors.DATASET_INVALID: DATASET_INVALID: An invalid dataset has been provided
  1. I tried to create a Region of interest, but the program returns 'recordsReturned': 0,
import shapely
import shapely.geometry
import shapely.geometry
import shapely.wkt
from pprint import pprint


site_points = shapely.geometry.Point((31.937769, -109.08029)).buffer(1)
site_polygon = shapely.geometry.Polygon(site_points)
points_string = str(site_polygon)[10:-2]
point_as_truple = points_string.split(",")
temp = [i.strip().split(" ") for i in point_as_truple]
ROI =[[[float(i[0]), float(i[1])] for i in temp]]
.
.....

results

/Downloads/usgs-machine-to-machine-API/UsageExample.py
Your login permissions is ['download', 'order']

{'data': {'isCustomized': False,
          'nextRecord': 0,
          'numExcluded': 0,
          'recordsReturned': 0,
          'results': [],
          'startingNumber': 0,
          'totalHits': 0,
          'totalHitsAccuracy': 'calculated'},
 'errorCode': None,
 'errorMessage': None,
 'requestId': 709518713,
 'sessionId': 133248151,
 'version': 'stable'}

Any help is much appreciated.

Python vs R USGS access to API

I know this may not be the right place for this, but are there restrictions to the programing language used to interact with the API?

For example in R, this could be the same as

psw ="usgs-pass.json" # provide path to the file with password and username
library(jsonlite)
library(httr)

api <- list(
  'apiURL' = paste0('https://m2m.cr.usgs.gov/api/api/json/stable/'), 
  'apiKey' = NULL,
  'loud_mode' = FALSE
)

jsonData = fromJSON(psw) 
password <- as.matrix(jsonData$password)
username <- as.matrix(jsonData$username)
urln = paste0(api$apiURL, "login")
userContext= NULL

params <- list('username' = username,
               'password' = password,
               'userContext' = userContext)

# res <- POST(urln, authenticate(username, password))
res <- POST(urln, body = params, encode = "json", user_agent("httr"))
# res <- POST(urln, body = params)
v <- content(res)$data

We are trying to revive usgs_login https://github.com/16EAGLE/getSpatialData, any help is much appreciated.

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.