r-spatial / dtwSat

Time-Weighted Dynamic Time Warping for satellite image time series analysis
https://www.victor-maus.com/dtwSat/
GNU General Public License v3.0
131 stars 39 forks source link

Extents do not overlap #36

Closed bkavlak closed 5 years ago

bkavlak commented 5 years ago

Hi,

I am trying to implement your code but have a problem as below:

When I use the code:

field_samples_ts <- getTimeSeries(raster_timeseries, 
                                  y = field_samples, proj4string = proj_str)

this shows up:

Error in extractTimeSeries.twdtwRaster(object, y) : 
  Extents do not overlap

raster_timeseries object is as below:

raster_timeseries <- twdtwRaster(blue, red, ndvi, green, nir, 
                                 timeline = dates)
> raster_timeseries
An object of class "twdtwRaster"
Time series layers: blue red ndvi green nir 
Time range: 2018-01-30 ... 2018-07-07 
Dimensions: 5 13084 18025 7 (nlayers, nrow, ncol, length)
Resolution: 3 3  (x, y)
Extent    : 581337 635412 4425114 4464366 (xmin, xmax, ymin, ymax)
Coord.ref.: +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0

Although I converted the coordinates to longlat from UTM values, it still has extents as UTM. I understood the error as the coordinates do not match with csv file I had, but it should be so. I taught it is because extent coordinates are in a different form. My csv coordinates are in

"+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"

as suggested. (i.e. -50.2707, -79.317)

If you may help me, it would really be perfect!

Thanks in advance

bkavlak commented 5 years ago

Sorry! It was a problem with coordinate not the code!