You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please note the example Django project in the `project/` directory of this
202
+
repository that shows how to use `django-large-image` in a `girder-4` project.
201
203
202
204
203
-
Please note the example Django project in the `project/` directory of this
204
-
repository that shows how to use `django-large-image`.
205
+
### Customization
205
206
206
-
## Work Plan
207
+
The `LargeImageView` is modularly designed and able to be subclassed for your
208
+
project's needs. While the provided `LargeImageView` handles
209
+
`FileFeild`-interfaces, you can easily extend it to handle any mechanism of
210
+
data storage.
207
211
208
-
Our primary goal is to get through phases 1 and 2, focusing on tile serving of
209
-
large geospatial images specifically in Cloud Optimized GeoTiff (COG) format.
212
+
In the following example, I will show how to use GDAL compatible VSI paths
213
+
from a model that stores `s3://` or `https://` URLs.
210
214
211
-
### Phase 1
215
+
```py
216
+
# model.py
217
+
from django.db import models
218
+
from rest_framework import serializers
212
219
213
-
-[x] Abstract API View classes that can be mixed-in downstream to expose all available endpoints
214
-
-[x] endpoints for metadata (/tiles, /tiles/internal_metadata)
215
-
-[x] endpoints for serving tiles (/tiles/zxy, /tiles/fzxy)
216
-
-[x] cache management - tile sources should be cached so that we don't open a file for each tile
217
-
-[x] endpoint for regions
218
-
-[x] endpoint for thumbnails
219
-
-[x] thumbnail caching
220
-
-[x] endpoint for individual pixels
221
-
-[x] endpoint for histograms
222
-
-[x] some diagnostic and settings endpoints (list available sources, set whether to automatically use large_images and the size of small images that can be used)
223
-
-[x] Support for django's FileFeild
224
-
-[x] Support for S3FileField
225
-
-[x] Ship an easily extensible SSR template for tile viewing with CesiumJS
226
-
-[x] Support for using file URLs with GDAL's VSI
227
-
-[x] Provide OpenAPI documentation in swagger
228
220
229
-
### Phase 2
221
+
classURLImageFile(models.Model):
222
+
name = models.TextField()
223
+
url = models.TextField()
224
+
230
225
231
-
-[ ] Handle band/component selection styling for tile serving and thumbnails
232
-
- e.g., use channels 3,7,5 for Red Green Blue
233
-
- endable linear/discrete color modes
234
-
-[ ] Tie large-image's caching into Django's cache (might require upstream work in large-image)
235
-
-[ ] Provide some sort of endpoint to check if an image is a valid COG
236
-
-[ ] Create a secondary app with celery tasks for converting images to COG
237
-
-[ ] Refactor/prototpye RGD's ChecksumFile model as a FieldFile subclass
238
-
-[ ] Support GeoDjango's [`GDALRaster`](https://docs.djangoproject.com/en/4.0/ref/contrib/gis/gdal/#django.contrib.gis.gdal.GDALRaster)
Things that would require implementing tasks with celery:
238
+
from django_large_image.rest import LargeImageViewMixin
239
+
from django_large_image.utilities import make_vsi
245
240
246
-
-[ ] ability to convert images via large_image_converter
247
-
-[ ] async endpoint for regions
248
241
249
-
Things I'm unsure about:
242
+
classURLLargeImageViewMixin(LargeImageViewMixin):
243
+
defget_path(self, request, pk):
244
+
object=self.get_object()
245
+
return make_vsi(object.url)
250
246
251
-
-[ ] endpoints for associated images
252
-
-[ ] ability to precache thumbnails (the thumbnail jobs endpoints)
253
-
-[ ] endpoints for serving tiles in deepzoom format
254
247
255
-
Things I think should be implemented downstream:
248
+
classURLImageFileDetailView(
249
+
mixins.ListModelMixin,
250
+
viewsets.GenericViewSet,
251
+
URLLargeImageViewMixin,
252
+
):
253
+
queryset = models.URLImageFile.objects.all()
254
+
serializer_class = models.URLImageFileSerializer
255
+
```
256
256
257
-
- endpoint or method to make / unmake a Django file field into a large_image item
258
-
- fuse-like ability to access filefields as os-level files (until implemented, s3 files will need to be pulled locally to serve them, which is inefficient)
257
+
Here is a good test image: https://oin-hotosm.s3.amazonaws.com/59c66c5223c8440011d7b1e4/0/7ad397c0-bba2-4f98-a08a-931ec3a6e943.tif
Our primary goal is to get through phases 1 and 2, focusing on tile serving of
4
+
large geospatial images specifically in Cloud Optimized GeoTiff (COG) format.
5
+
6
+
### Phase 1
7
+
8
+
-[x] Abstract API View classes that can be mixed-in downstream to expose all available endpoints
9
+
-[x] endpoints for metadata (/tiles, /tiles/internal_metadata)
10
+
-[x] endpoints for serving tiles (/tiles/zxy, /tiles/fzxy)
11
+
-[x] cache management - tile sources should be cached so that we don't open a file for each tile
12
+
-[x] endpoint for regions
13
+
-[x] endpoint for thumbnails
14
+
-[x] thumbnail caching
15
+
-[x] endpoint for individual pixels
16
+
-[x] endpoint for histograms
17
+
-[x] some diagnostic and settings endpoints (list available sources, set whether to automatically use large_images and the size of small images that can be used)
18
+
-[x] Support for django's FileFeild
19
+
-[x] Support for S3FileField
20
+
-[x] Ship an easily extensible SSR template for tile viewing with CesiumJS
21
+
-[x] Support for using file URLs with GDAL's VSI
22
+
-[x] Provide OpenAPI documentation in swagger
23
+
24
+
### Phase 2
25
+
26
+
-[ ] Handle band/component selection styling for tile serving and thumbnails
27
+
- e.g., use channels 3,7,5 for Red Green Blue
28
+
- endable linear/discrete color modes
29
+
-[ ] Tie large-image's caching into Django's cache (might require upstream work in large-image)
30
+
-[ ] Provide some sort of endpoint to check if an image is a valid COG
31
+
-[ ] Create a secondary app with celery tasks for converting images to COG
32
+
-[ ] Refactor/prototpye RGD's ChecksumFile model as a FieldFile subclass
33
+
-[ ] Support GeoDjango's [`GDALRaster`](https://docs.djangoproject.com/en/4.0/ref/contrib/gis/gdal/#django.contrib.gis.gdal.GDALRaster)
34
+
35
+
### Phase 3 and onward
36
+
37
+
Incorporate more features from large-image.
38
+
39
+
Things that would require implementing tasks with celery:
40
+
41
+
-[ ] ability to convert images via large_image_converter
42
+
-[ ] async endpoint for regions
43
+
44
+
Things I'm unsure about:
45
+
46
+
-[ ] endpoints for associated images
47
+
-[ ] ability to precache thumbnails (the thumbnail jobs endpoints)
48
+
-[ ] endpoints for serving tiles in deepzoom format
49
+
50
+
Things I think should be implemented downstream:
51
+
52
+
- endpoint or method to make / unmake a Django file field into a large_image item
53
+
- fuse-like ability to access filefields as os-level files (until implemented, s3 files will need to be pulled locally to serve them, which is inefficient)
0 commit comments