Lunar Moon phases dates in Survey123

456
2
07-27-2020 05:43 PM
FedericoRiet_Sapriza
New Contributor III

Hi

how can I include the lunar phase when I select the date in the Survey123 form?

Any ideas

Cheers

F

0 Kudos
2 Replies
ZacharySutherby
Esri Regular Contributor

Hello Federico Riet Sapriza‌, 

One option would be to use the Survey123 custom JavaScript Pulldata() functions to hit a lunar phases API. 

I have attached a sample that hits a weather API based on a Geopoint location. The sample may be able to be modified in which the survey will pass along a date and the JavaScript function will hit a lunar phases API to return the phase for that date. 

In researching it seems that NOAA has an API that may be able to be used to extract this information. 

Please use these links for reference: 

php - Lunar Phase API - Stack Overflow 

Astronomical Data - NOAA Tides & Currents 

Another option is to potentially use the NOAA information above and create a CSV file with dates and phases for some period of time in the future and use the pulldata() function in your survey to grab those values. 

Thank you, 

Zach

Thank you,
Zach
FedericoRiet_Sapriza
New Contributor III

Hi Zach,

thanks so much for your help and input, this most needed by biologist  and other researchers.

The pulldata function option is probably the best, however, I wan't able to find an downloadable excel spreadsheet with this data on the web.

I come across this calculation based on the date that I try to insert into XML Survey123 spreadsheet but without success:

Phase =

(((#DNOW#/2551442844-0.228535)
+0.00591997sin(#DNOW#/5023359217+3.1705094)
+0.017672776
sin(#DNOW#/378923968-1.5388144)
-0.0038844429sin(#DNOW#/437435791+2.0017235)
-0.00041488
sin(#DNOW#/138539900-1.236334))%1)

link: Moon Phase formula - updated - Expression Help - FACER Community 

 Thanks for the sample that hits a weather API based on a Geopoint location.

Thanks again for you time and aid.

Cheers,

Federico

0 Kudos