@@ -680,11 +680,16 @@ def set_thumbnail_from_bbox(self, request, resource_id, *args, **kwargs):
680680 try :
681681 resource = ResourceBase .objects .get (id = ast .literal_eval (resource_id ))
682682
683+ map_thumb_from_bbox = False
684+ if isinstance (resource .get_real_instance (), Map ):
685+ map_thumb_from_bbox = True
686+
683687 if not isinstance (resource .get_real_instance (), (Dataset , Map )):
684688 raise NotImplementedError ("Not implemented: Endpoint available only for Dataset and Maps" )
685689
686690 request_body = request .data if request .data else json .loads (request .body )
687691 try :
692+ # bbox format: (xmin, xmax, ymin, ymax)
688693 bbox = request_body ["bbox" ] + [request_body ["srid" ]]
689694 zoom = request_body .get ("zoom" , None )
690695 except MultiValueDictKeyError :
@@ -695,7 +700,11 @@ def set_thumbnail_from_bbox(self, request, resource_id, *args, **kwargs):
695700 zoom = request_body .get ("zoom" , None )
696701
697702 thumbnail_url = create_thumbnail (
698- resource .get_real_instance (), bbox = bbox , background_zoom = zoom , overwrite = True
703+ resource .get_real_instance (),
704+ bbox = bbox ,
705+ background_zoom = zoom ,
706+ overwrite = True ,
707+ map_thumb_from_bbox = map_thumb_from_bbox ,
699708 )
700709 return Response (
701710 {"message" : "Thumbnail correctly created." , "success" : True , "thumbnail_url" : thumbnail_url }, status = 200
0 commit comments