Skip to main content

Edit: The DateTime did exist in the output in the "Time" attribute as a ISO8601 format.

 

Problem.

I want to add starttime and endtime as attributes to the export.

 

I have a working simple workspace that reads a JSON from:

 

https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=@Value(date_sub)&endtime=@Value(date)

 

where starttime (value) and endtime(value) are in the format "yyyy-mm-dd" and is created as FME parameters.

 

The string original looks like this

https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=yyyy-mm-dd&endtime=yyyy-mm-dd

 

I am exposing the attributes I want with attribute exposer and it works at it should according to the documentation "GeoJSON Summary Format (usgs.gov)"

 

The starttime and endtime attributes is the date window where I want to read the event data from USGS.

 

So I guess there is timedata from the earthquake event that stores the date when its monitored. That is the data and time I want to get.

 

 

In the FeatureReader, set Attribute Accumulation Mode from "Only Use Result" to "Merge Initiator and Result".

2021-02-15_16h49_41


In the FeatureReader, set Attribute Accumulation Mode from "Only Use Result" to "Merge Initiator and Result".

2021-02-15_16h49_41

Hello,

Thank you for your answer. I edit my question since I understand I put it wrong.

Your answer is correct due to my question.

 

But now i have adjust my question with this lines.

 

The starttime and endtime attributes is the date window where I want to read the event data from USGS.

 

So I guess there is time data from the earthquake event that stores the date when its monitored. That is the data and time I want to get.


There is a time returned in the data which looks like a UNIX timestamp, you should be able to convert this to a datetime by dividing by 1000 and then using a DateTimeConverter with input %s


aa,, ok. I was wondering what kind of timeformat that was. Thanks. I will try that.


I was not able to convert the time with the default DateTimeConverter transformer but I found a custom transformer that worked fine and then i added DateTimeConverter to get %y%m%d format.

I could probably tweak the python code to fix the date it without the DateTimeConverter. But this solution works fine and I am happy for now.

 

Thank you all. !!!


I was not able to convert the time with the default DateTimeConverter transformer but I found a custom transformer that worked fine and then i added DateTimeConverter to get %y%m%d format.

I could probably tweak the python code to fix the date it without the DateTimeConverter. But this solution works fine and I am happy for now.

 

Thank you all. !!!

The DateTimeFormatter should work as long as you divide by 1000 first, and the s in %s must be lowercase

Capture


The DateTimeFormatter should work as long as you divide by 1000 first, and the s in %s must be lowercase

Capture

Thanks,

Ive learned something new today.

It works.


Reply