Skip to content

Commit

Permalink
internal_metadata -> metadata_internal
Browse files Browse the repository at this point in the history
  • Loading branch information
banesullivan committed Apr 18, 2022
1 parent a020b2c commit f156cd4
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ tiles with CesiumJS and non-geospatial image tiles with [GeoJS](https://github.c
### 🌟 Features

Rich set of RESTful endpoints to extract information from large image formats:
- Image metadata (`/metadata`, `/internal_metadata`)
- Image metadata (`/metadata`, `/metadata_internal`)
- Tile serving (`/tiles/{z}/{x}/{y}.png?projection=EPSG:3857`)
- Region extraction (`/region.tif?left=v&right=v&top=v&bottom=v`)
- Image thumbnails (`/thumbnail.png`)
Expand Down
2 changes: 1 addition & 1 deletion ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ large geospatial images specifically in Cloud Optimized GeoTiff (COG) format.
### Phase 1

- [x] Abstract API View classes that can be mixed-in downstream to expose all available endpoints
- [x] endpoints for metadata (/tiles, /tiles/internal_metadata)
- [x] endpoints for metadata (/tiles, /tiles/metadata_internal)
- [x] endpoints for serving tiles (/tiles/zxy, /tiles/fzxy)
- [x] cache management - tile sources should be cached so that we don't open a file for each tile
- [x] endpoint for regions
Expand Down
20 changes: 10 additions & 10 deletions django_large_image/rest/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

metadata_summary = 'Returns tile metadata.'
metadata_parameters = [params.projection]
internal_metadata_summary = 'Returns additional known metadata about the tile source.'
internal_metadata_parameters = [params.projection]
metadata_internal_summary = 'Returns additional known metadata about the tile source.'
metadata_internal_parameters = [params.projection]
bands_summary = 'Returns bands information.'
bands_parameters = [params.projection]
band_summary = 'Returns single band information.'
Expand All @@ -31,13 +31,13 @@ def metadata(self, request: Request, pk: int = None) -> Response:

@swagger_auto_schema(
method='GET',
operation_summary=internal_metadata_summary,
manual_parameters=internal_metadata_parameters,
operation_summary=metadata_internal_summary,
manual_parameters=metadata_internal_parameters,
)
@action(detail=False)
def internal_metadata(self, request: Request, pk: int = None) -> Response:
def metadata_internal(self, request: Request, pk: int = None) -> Response:
source = self.get_tile_source(request, pk, style=False)
metadata = tilesource.get_internal_metadata(source)
metadata = tilesource.get_metadata_internal(source)
return Response(metadata)

@swagger_auto_schema(
Expand Down Expand Up @@ -76,12 +76,12 @@ def metadata(self, request: Request, pk: int = None) -> Response:

@swagger_auto_schema(
method='GET',
operation_summary=internal_metadata_summary,
manual_parameters=internal_metadata_parameters,
operation_summary=metadata_internal_summary,
manual_parameters=metadata_internal_parameters,
)
@action(detail=True)
def internal_metadata(self, request: Request, pk: int = None) -> Response:
return super().internal_metadata(request, pk)
def metadata_internal(self, request: Request, pk: int = None) -> Response:
return super().metadata_internal(request, pk)

@swagger_auto_schema(
method='GET',
Expand Down
2 changes: 1 addition & 1 deletion django_large_image/tilesource.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def get_metadata(source: FileTileSource) -> dict:
return metadata


def get_internal_metadata(source: FileTileSource) -> dict:
def get_metadata_internal(source: FileTileSource) -> dict:
metadata = source.getInternalMetadata()
_metadata_helper(source, metadata)
return metadata
Expand Down
6 changes: 3 additions & 3 deletions project/example/core/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
@admin.register(ImageFile)
class ImageFileAdmin(admin.ModelAdmin):
list_display_links = ('pk', 'thumbnail')
list_display = ('pk', 'thumbnail', 'metadata', 'internal_metadata')
list_display = ('pk', 'thumbnail', 'metadata', 'metadata_internal')


@admin.register(S3ImageFile)
class S3ImageFileAdmin(admin.ModelAdmin):
list_display_links = ('pk', 'thumbnail')
list_display = ('pk', 'thumbnail', 'metadata', 'internal_metadata')
list_display = ('pk', 'thumbnail', 'metadata', 'metadata_internal')


@admin.register(URLImageFile)
class URLImageFileAdmin(admin.ModelAdmin):
list_display_links = ('pk', 'thumbnail')
list_display = ('pk', 'thumbnail', 'metadata', 'internal_metadata')
list_display = ('pk', 'thumbnail', 'metadata', 'metadata_internal')
6 changes: 3 additions & 3 deletions project/example/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ def metadata(self):

metadata.allow_tags = True

def internal_metadata(self):
def metadata_internal(self):
return a_html(
reverse(f'{self.url_name}-internal-metadata', args=[self.pk]), 'internal metadata'
reverse(f'{self.url_name}-metadata-internal', args=[self.pk]), 'internal metadata'
)

internal_metadata.allow_tags = True
metadata_internal.allow_tags = True


class ImageFile(TimeStampedModel, Mixin):
Expand Down
4 changes: 2 additions & 2 deletions project/example/core/tests/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ def test_metadata_s3_vsi(authenticated_api_client, s3_image_file_geotiff):


@pytest.mark.django_db(transaction=True)
def test_internal_metadata(authenticated_api_client, image_file_geotiff):
def test_metadata_internal(authenticated_api_client, image_file_geotiff):
response = authenticated_api_client.get(
f'/api/image-file/{image_file_geotiff.pk}/internal_metadata'
f'/api/image-file/{image_file_geotiff.pk}/metadata_internal'
)
assert response.status_code == 200
metadata = response.data
Expand Down

0 comments on commit f156cd4

Please sign in to comment.