nasa / api-docs

api.nasa.gov
http://nasa.github.io/api-docs/
450 stars 109 forks source link

HD image missing in APOD response #36

Closed martinsuchan closed 8 years ago

martinsuchan commented 9 years ago

I just found that the APOD API returns only link to the image in standard resolution, not the additional HD image that is sometimes available when visiting the webpage directly.

Like here: http://apod.nasa.gov/apod/ap150427.html and the HD image: http://apod.nasa.gov/apod/image/1504/SpaceStationTerminator_Caxete_2048.jpg

It should be easy to add it to the API without even breaking existing apps that are using it.

knynkwl commented 9 years ago

+1

danhammer commented 9 years ago

thanks for the note. I'll get back to you shortly. sorry for the delay!

danhammer commented 9 years ago

Ok! Slowly checking this off. I will close this comment when I update the docs. There is a now new parameter, hd, which defaults to False for both endpoints discussed here. For example,

https://api.nasa.gov/planetary/apod?date=2015-04-27&api_key=DEMO_KEY
{
  "url": "http://apod.nasa.gov/apod/image/1504/SpaceStationTerminator_Caxete_960.jpg",
  "media_type": "image", 
  "explanation": "What's that in front of the Moon? It's the International Space Station. Using precise timing, the Earth-orbiting space platform was photographed in front of a partially lit Moon last year. The featured image was taken from Madrid, Spain with an exposure time of only 1/1000 of a second. In contrast, the duration of the transit of the ISS across the entire Moon was about half a second.  The sun-glinting station can be seen just to the dark side of the day / night line known as the terminator. Numerous circular craters are visible on the distant Moon, as well as comparatively rough, light colored terrain known as highlands, and relatively smooth, dark colored areas known as maria.  On-line tools can tell you when the International Space Station will be visible from your area.   Follow APOD on: Facebook,  Google Plus, or Twitter", 
  "concepts": null, 
  "title": "Space Station over Lunar Terminator"
}

VERSUS

https://api.nasa.gov/planetary/apod?date=2015-04-27&hd=True&api_key=DEMO_KEY
{
  "url": "http://apod.nasa.gov/apod/image/1504/SpaceStationTerminator_Caxete_2048.jpg",
  "media_type": "image", 
  "explanation": "What's that in front of the Moon? It's the International Space Station. Using precise timing, the Earth-orbiting space platform was photographed in front of a partially lit Moon last year. The featured image was taken from Madrid, Spain with an exposure time of only 1/1000 of a second. In contrast, the duration of the transit of the ISS across the entire Moon was about half a second.  The sun-glinting station can be seen just to the dark side of the day / night line known as the terminator. Numerous circular craters are visible on the distant Moon, as well as comparatively rough, light colored terrain known as highlands, and relatively smooth, dark colored areas known as maria.  On-line tools can tell you when the International Space Station will be visible from your area.   Follow APOD on: Facebook,  Google Plus, or Twitter", 
  "concepts": null, 
  "title": "Space Station over Lunar Terminator"
}
martinsuchan commented 9 years ago

Hi, that's not exactly the solution I was hoping for. Usually I need in my app both standard image for preview and HD image for download. For getting both images I'd need to use two requests, or just one and use the HD image everywhere. Better solution could be having in the response both "url": and "hdurl": with both images?

danhammer commented 9 years ago

I added this functionality. Please keep me posted on what you're doing with it!! I'd love to see.

https://api.nasa.gov/planetary/apod?date=2015-06-05&hd=True&api_key=DEMO_KEY
{
  "concepts": null, 
  "url": "http://apod.nasa.gov/apod/image/1506/FlashMoon_OT_from_ORM_140km-DLopez_840mm600.jpg", 
  "media_type": "image", 
  "explanation": "Follow a sunset on a clear day against a distant horizon and you might glimpse a green flash just as the Sun disappears, the sunlight briefly refracted over a long sight-line through atmospheric layers. You can spot a green flash at sunrise too. Pinpointing the exact place and time to see the rising Sun peeking above the horizon is a little more difficult though, and it can be harder still to catch a green flash from the fainter rising Moon. But well-planned snapshots did record a green flash at the Full Moon's upper edge on June 2nd, from the Roque de los Muchachos Observatory on the Canary Island of La Palma. Looking a little south of due east, this long telephoto view finds the rising Moon above mountains and a sea of clouds. In sunlit profile are the mountaintop Teide Observatory telescope domes on the island of Tenerife some 143 kilometers away.", 
  "title": "Green Flash at Moonrise", 
  "hdurl": "http://apod.nasa.gov/apod/image/1506/FlashMoon_OT_from_ORM_140km-DLopez_840mm.jpg"
}
brianthomas commented 8 years ago

Note: HD flag in the lastest refactor is allowed, but effectively does nothing. We always pass back hdurl and url if they are available.