kopia lustrzana https://github.com/OpenDroneMap/WebODM
				
				
				
			Some error handling, tests
							rodzic
							
								
									d563052d07
								
							
						
					
					
						commit
						dcb023db18
					
				| 
						 | 
				
			
			@ -299,8 +299,10 @@ class Tiles(TaskNestedView):
 | 
			
		|||
        if boundaries_feature == '':
 | 
			
		||||
            boundaries_feature = None
 | 
			
		||||
        if boundaries_feature is not None:
 | 
			
		||||
            boundaries_feature = json.loads(boundaries_feature)
 | 
			
		||||
 | 
			
		||||
            try:
 | 
			
		||||
                boundaries_feature = json.loads(boundaries_feature)
 | 
			
		||||
            except json.JSONDecodeError:
 | 
			
		||||
                raise exceptions.ValidationError("Invalid boundaries parameter")
 | 
			
		||||
 | 
			
		||||
        if formula == '': formula = None
 | 
			
		||||
        if bands == '': bands = None
 | 
			
		||||
| 
						 | 
				
			
			@ -344,7 +346,10 @@ class Tiles(TaskNestedView):
 | 
			
		|||
            if z < minzoom - ZOOM_EXTRA_LEVELS or z > maxzoom + ZOOM_EXTRA_LEVELS:
 | 
			
		||||
                raise exceptions.NotFound()
 | 
			
		||||
            if boundaries_feature is not None:
 | 
			
		||||
                boundaries_cutline = create_cutline(src.dataset, boundaries_feature, CRS.from_string('EPSG:4326'))
 | 
			
		||||
                try:
 | 
			
		||||
                    boundaries_cutline = create_cutline(src.dataset, boundaries_feature, CRS.from_string('EPSG:4326'))
 | 
			
		||||
                except:
 | 
			
		||||
                    raise exceptions.ValidationError("Invalid boundaries")
 | 
			
		||||
            else:
 | 
			
		||||
                boundaries_cutline = None
 | 
			
		||||
            # Handle N-bands datasets for orthophotos (not plant health)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -660,6 +660,11 @@ class TestApiTask(BootTransactionTestCase):
 | 
			
		|||
                ("orthophoto", "formula=NDVI&bands=RGN&color_map=rdylgn&rescale=1,-1", status.HTTP_200_OK),
 | 
			
		||||
 | 
			
		||||
                ("orthophoto", "formula=NDVI&bands=RGN&color_map=invalid", status.HTTP_400_BAD_REQUEST),
 | 
			
		||||
 | 
			
		||||
                ("orthophoto", "boundaries=invalid", status.HTTP_400_BAD_REQUEST),
 | 
			
		||||
                ("orthophoto", "boundaries=%7B%22a%22%3A%20true%7D", status.HTTP_400_BAD_REQUEST),
 | 
			
		||||
                
 | 
			
		||||
                ("orthophoto", "boundaries=%7B%22type%22%3A%22Feature%22%2C%22properties%22%3A%7B%22Length%22%3A52.98642774268887%2C%22Area%22%3A139.71740455567166%7D%2C%22geometry%22%3A%7B%22type%22%3A%22Polygon%22%2C%22coordinates%22%3A%5B%5B%5B-91.993925%2C46.842686%5D%2C%5B-91.993928%2C46.842756%5D%2C%5B-91.994024%2C46.84276%5D%2C%5B-91.994018%2C46.842582%5D%2C%5B-91.993928%2C46.842585%5D%2C%5B-91.993925%2C46.842686%5D%5D%5D%7D%7D", status.HTTP_200_OK)
 | 
			
		||||
            ]
 | 
			
		||||
 | 
			
		||||
            for k in algos:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Ładowanie…
	
		Reference in New Issue