0

I'm trying to download sentinel-2 satellite images from sentinel-hub (https://www.sentinel-hub.com/) via WMS requests. The request allows me to specify a time interval with the time parameter but the I don't seem to be getting all the images in the specified time interval.

The problem I'm trying to solve is the following:

Given a bounding box (latmin,longmin,latmax,longmax) I would like to get all the satellite images taken in the box from a date yyyy-mm-dd to another YYYY-MM-DD. The returned object should be some sort of an array of images, ideally with a timestamp on every image.

I'm building a wms getmap request with python and this is what I've already done.

dist = 5
#i = 21800
for i in range(0,len(fireBC)):
    if fireBC["FIRE_YEAR"][i] >= 2018:
        
center = np.array(fireBC['geometry'][i].representative_point())
date = fireBC['FIRE_DATE'][i]
firedateB = dt.datetime.strptime(date, '%Y%m%d')
firedateE = firedateB + dt.timedelta(days=10)
firedate_str = firedateB.strftime("%Y-%m-%d") + "/" + firedateE.strftime("%Y-%m-%d")

fire_imgnew = wms.getmap(  
                    layers=['SWIR'],
                     styles=['default'],
                     srs='EPSG:4326',
                     bbox=boundingBox(center[0],center[1],dist),
                     size=(512, 512),
                     #geometry = ade,
                     format='image/png',
                     #Transparent = False,
                     time=firedate_str)

print(type(fire_imgnew))
decoded = cv2.imdecode(np.frombuffer(fire_imgnew.read(), np.uint8), -1)
cv2.imwrite("Images/fire"+str(i)+".png", decoded) 

FireBC is a geopandas files of all historic forest fires in British Columbia Canada.

The number of requests that I can make is limited.

Is there no way to get an array of images with one request?

  • 2
    Welcome to Geographic Information Systems! Welcome to GIS SE! We're a little different from other sites; this isn't a discussion forum but a Q&A site. Your questions should as much as possible describe not just what you want to do, but precisely what you have tried and where you are stuck trying that. Please check out our short tour for more about how the site works. – Ian Turton Jul 8 at 16:30
1

You will need to generate a series of requests one for each time period you require.

Automation will probably be the best way to proceed, but since you haven't specified any programming language or given us some code to work from there isn't much more we can do to help.

| improve this answer | |
  • So I have specified a time period in my wms request but it only returns one image. Is there anyway to get all of the images in the specified time period? – Frank Jul 8 at 17:46
  • No you must request one for each time period you want. – Ian Turton Jul 9 at 7:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.