-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented basic GeoTiff read support. See #26.
- Loading branch information
1 parent
1eb257d
commit 24c5cc7
Showing
46 changed files
with
862 additions
and
3,753 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,4 @@ | |
/build/ | ||
/local.properties | ||
/.idea/kim.iml | ||
/src/commonTest/resources/com/ashampoo/kim/testdata/full/*.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
src/commonMain/kotlin/com/ashampoo/kim/format/tiff/constant/GeoTiffTag.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Copyright 2024 Ashampoo GmbH & Co. KG | ||
* Copyright 2007-2023 The Apache Software Foundation | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.ashampoo.kim.format.tiff.constant | ||
|
||
import com.ashampoo.kim.format.tiff.constant.ExifTag.EXIF_DIRECTORY_UNKNOWN | ||
import com.ashampoo.kim.format.tiff.taginfo.TagInfoAscii | ||
import com.ashampoo.kim.format.tiff.taginfo.TagInfoDoubles | ||
import com.ashampoo.kim.format.tiff.taginfo.TagInfoShorts | ||
|
||
/** | ||
* See https://exiftool.org/TagNames/GeoTiff.html | ||
*/ | ||
@Suppress("MagicNumber") | ||
object GeoTiffTag { | ||
|
||
val EXIF_TAG_MODEL_PIXEL_SCALE_TAG: TagInfoDoubles = TagInfoDoubles( | ||
0x830e, "ModelPixelScaleTag", 3, | ||
EXIF_DIRECTORY_UNKNOWN | ||
) | ||
|
||
val EXIF_TAG_INTERGRAPH_MATRIX_TAG: TagInfoDoubles = TagInfoDoubles( | ||
0x8480, "IntergraphMatrixTag", -1, | ||
EXIF_DIRECTORY_UNKNOWN | ||
) | ||
|
||
val EXIF_TAG_MODEL_TIEPOINT_TAG: TagInfoDoubles = TagInfoDoubles( | ||
0x8482, "ModelTiepointTag", -1, | ||
EXIF_DIRECTORY_UNKNOWN | ||
) | ||
|
||
val EXIF_TAG_MODEL_TRANSFORMATION_TAG: TagInfoDoubles = TagInfoDoubles( | ||
0x85d8, "ModelTransformationTag", 16, | ||
EXIF_DIRECTORY_UNKNOWN | ||
) | ||
|
||
val EXIF_TAG_GEO_KEY_DIRECTORY_TAG: TagInfoShorts = TagInfoShorts( | ||
0x87af, "GeoKeyDirectoryTag", -1, | ||
EXIF_DIRECTORY_UNKNOWN | ||
) | ||
|
||
val EXIF_TAG_GEO_DOUBLE_PARAMS_TAG: TagInfoDoubles = TagInfoDoubles( | ||
0x87b0, "GeoDoubleParamsTag", -1, | ||
EXIF_DIRECTORY_UNKNOWN | ||
) | ||
|
||
val EXIF_TAG_GEO_ASCII_PARAMS_TAG: TagInfoAscii = TagInfoAscii( | ||
0x87b1, "GeoAsciiParamsTag", -1, | ||
EXIF_DIRECTORY_UNKNOWN | ||
) | ||
|
||
val ALL = listOf( | ||
EXIF_TAG_MODEL_PIXEL_SCALE_TAG, | ||
EXIF_TAG_INTERGRAPH_MATRIX_TAG, | ||
EXIF_TAG_MODEL_TIEPOINT_TAG, | ||
EXIF_TAG_MODEL_TRANSFORMATION_TAG, | ||
EXIF_TAG_GEO_KEY_DIRECTORY_TAG, | ||
EXIF_TAG_GEO_DOUBLE_PARAMS_TAG, | ||
EXIF_TAG_GEO_ASCII_PARAMS_TAG | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
src/commonMain/kotlin/com/ashampoo/kim/format/tiff/geotiff/GeoKey.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/* | ||
* Copyright 2024 Ashampoo GmbH & Co. KG | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.ashampoo.kim.format.tiff.geotiff | ||
|
||
import kotlin.jvm.JvmStatic | ||
|
||
/** | ||
* See http://geotiff.maptools.org/spec/geotiff6.html | ||
*/ | ||
@Suppress("MagicNumber") | ||
enum class GeoKey( | ||
val keyId: Short | ||
) { | ||
|
||
/* 6.2.1 GeoTIFF Configuration Keys */ | ||
GTModelTypeGeoKey(1024), | ||
GTRasterTypeGeoKey(1025), | ||
GTCitationGeoKey(1026), | ||
|
||
/* 6.2.2 Geographic CS Parameter Keys */ | ||
GeographicTypeGeoKey(2048), | ||
GeogCitationGeoKey(2049), | ||
GeogGeodeticDatumGeoKey(2050), | ||
GeogPrimeMeridianGeoKey(2051), | ||
GeogLinearUnitsGeoKey(2052), | ||
GeogLinearUnitSizeGeoKey(2053), | ||
GeogAngularUnitsGeoKey(2054), | ||
GeogAngularUnitSizeGeoKey(2055), | ||
GeogEllipsoidGeoKey(2056), | ||
GeogSemiMajorAxisGeoKey(2057), | ||
GeogSemiMinorAxisGeoKey(2058), | ||
GeogInvFlatteningGeoKey(2059), | ||
GeogAzimuthUnitsGeoKey(2060), | ||
GeogPrimeMeridianLongGeoKey(2061), | ||
|
||
/* 6.2.3 Projected CS Parameter Keys */ | ||
ProjectedCSTypeGeoKey(3072), | ||
PCSCitationGeoKey(3073), | ||
ProjectionGeoKey(3074), | ||
ProjCoordTransGeoKey(3075), | ||
ProjLinearUnitsGeoKey(3076), | ||
ProjLinearUnitSizeGeoKey(3077), | ||
ProjStdParallel1GeoKey(3078), | ||
ProjStdParallel2GeoKey(3079), | ||
ProjNatOriginLongGeoKey(3080), | ||
ProjNatOriginLatGeoKey(3081), | ||
ProjFalseEastingGeoKey(3082), | ||
ProjFalseNorthingGeoKey(3083), | ||
ProjFalseOriginLongGeoKey(3084), | ||
ProjFalseOriginLatGeoKey(3085), | ||
ProjFalseOriginEastingGeoKey(3086), | ||
ProjFalseOriginNorthingGeoKey(3087), | ||
ProjCenterLongGeoKey(3088), | ||
ProjCenterLatGeoKey(3089), | ||
ProjCenterEastingGeoKey(3090), | ||
ProjCenterNorthingGeoKey(3091), | ||
ProjScaleAtNatOriginGeoKey(3092), | ||
ProjScaleAtCenterGeoKey(3093), | ||
ProjAzimuthAngleGeoKey(3094), | ||
ProjStraightVertPoleLongGeoKey(3095), | ||
|
||
/* 6.2.4 Vertical CS Keys */ | ||
VerticalCSTypeGeoKey(4096), | ||
VerticalCitationGeoKey(4097), | ||
VerticalDatumGeoKey(4098), | ||
VerticalUnitsGeoKey(4099); | ||
|
||
companion object { | ||
|
||
@JvmStatic | ||
fun of(keyId: Short): GeoKey? = | ||
GeoKey.entries.firstOrNull { it.keyId == keyId } | ||
} | ||
} |
Oops, something went wrong.