Skip to content

Commit

Permalink
Allow exporting existing geoframe to geojson
Browse files Browse the repository at this point in the history
  • Loading branch information
glopesdev committed Aug 24, 2023
1 parent a083ea9 commit 1719935
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions pluma/export/ogcapi/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,20 @@ def export_dataset_to_geojson(
):

out = convert_dataset_to_geoframe(dataset, sampling_dt, rereference_to_ubx_time)
out = out.reset_index(names='time')
micro_format = '.%f' if sampling_dt.microseconds != 0 else ''
export_geoframe_to_geojson(out, filename)

def export_geoframe_to_geojson(
frame,
filename):
micro_format = '.%f'
try:
if frame.index.freq.delta.to_pytimedelta().microseconds == 0:
micro_format = ''
except:
pass
out = frame.reset_index(names='time')
out.time = out.time.dt.strftime(f"%Y-%m-%dT%H:%M:%S{micro_format}Z")
out.index.name = 'id'
out.index.name = 'id'
out.to_file(filename, driver='GeoJSON', index=True)

def recursive_resample_stream(acc_dict, stream, sampling_dt):
Expand Down

0 comments on commit 1719935

Please sign in to comment.