topo_map_processor 0.1.17__tar.gz → 0.1.19__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: topo_map_processor
3
- Version: 0.1.17
3
+ Version: 0.1.19
4
4
  Summary: Library for processing topographic maps
5
5
  Project-URL: homepage, https://github.com/ramSeraph/topo_map_processor
6
6
  Project-URL: repository, https://github.com/ramSeraph/topo_map_processor.git
@@ -31,6 +31,7 @@ License: This is free and unencumbered software released into the public domain.
31
31
  For more information, please refer to <https://unlicense.org>
32
32
  License-File: LICENSE
33
33
  Requires-Python: >=3.12
34
+ Requires-Dist: gh-release-tools>=0.1.12
34
35
  Requires-Dist: mercantile>=1.2.1
35
36
  Requires-Dist: pmtiles-mosaic>=0.1.0
36
37
  Requires-Dist: requests>=2.32.4
@@ -57,6 +58,7 @@ Requires-Dist: click==8.3.0; extra == 'pinned'
57
58
  Requires-Dist: colorama==0.4.6; (sys_platform == 'win32') and extra == 'pinned'
58
59
  Requires-Dist: colorlog==6.9.0; extra == 'pinned'
59
60
  Requires-Dist: frozenlist==1.7.0; extra == 'pinned'
61
+ Requires-Dist: gh-release-tools==0.1.12; extra == 'pinned'
60
62
  Requires-Dist: idna==3.10; extra == 'pinned'
61
63
  Requires-Dist: mercantile==1.2.1; extra == 'pinned'
62
64
  Requires-Dist: multidict==6.6.4; extra == 'pinned'
@@ -368,6 +370,10 @@ The general workflow is as follows:
368
370
 
369
371
  This workflow ensures that your tile set is updated efficiently, without having to re-process the entire map collection.
370
372
 
373
+ ## Alternate Tools
374
+
375
+ For a more saner/cleaner version of doing the georeferencing/tiling/retiling without using GDAL check out [wladich/map-tiler](https://github.com/wladich/map-tiler)
376
+
371
377
  ## Contributing
372
378
 
373
379
  Contributions are welcome! Please feel free to submit a pull request.
@@ -293,6 +293,10 @@ The general workflow is as follows:
293
293
 
294
294
  This workflow ensures that your tile set is updated efficiently, without having to re-process the entire map collection.
295
295
 
296
+ ## Alternate Tools
297
+
298
+ For a more saner/cleaner version of doing the georeferencing/tiling/retiling without using GDAL check out [wladich/map-tiler](https://github.com/wladich/map-tiler)
299
+
296
300
  ## Contributing
297
301
 
298
302
  Contributions are welcome! Please feel free to submit a pull request.
@@ -8,6 +8,7 @@ authors = [
8
8
  { name = "Sreeram Kandimalla", email = "kandimalla.sreeram@gmail.com" },
9
9
  ]
10
10
  dependencies = [
11
+ "gh-release-tools>=0.1.12",
11
12
  "mercantile>=1.2.1",
12
13
  "pmtiles-mosaic>=0.1.0",
13
14
  "requests>=2.32.4",
@@ -42,6 +43,7 @@ pinned = [
42
43
  "colorama==0.4.6 ; sys_platform == 'win32'",
43
44
  "colorlog==6.9.0",
44
45
  "frozenlist==1.7.0",
46
+ "gh-release-tools==0.1.12",
45
47
  "idna==3.10",
46
48
  "mercantile==1.2.1",
47
49
  "multidict==6.6.4",
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '0.1.17'
32
- __version_tuple__ = version_tuple = (0, 1, 17)
31
+ __version__ = version = '0.1.19'
32
+ __version_tuple__ = version_tuple = (0, 1, 19)
33
33
 
34
34
  __commit_id__ = commit_id = None
@@ -134,6 +134,8 @@ class TopoMapProcessor:
134
134
  self.jpeg_export_quality = extra.get('jpeg_export_quality', 75)
135
135
  self.warp_jpeg_export_quality = extra.get('warp_jpeg_export_quality', 75)
136
136
  self.warp_output_height = extra.get('warp_output_height', 6500)
137
+ self.warp_resampling_method = extra.get('warp_resampling_method', 'bilinear')
138
+ self.export_resampling_method = extra.get('export_resampling_method', 'nearest') # nearest for backwards compatibility
137
139
 
138
140
 
139
141
  self.color_map = {
@@ -1790,15 +1792,17 @@ class TopoMapProcessor:
1790
1792
  warp_quality_config.update({'TILED': 'YES'})
1791
1793
  warp_quality_options = ' '.join([ f'-co {k}={v}' for k,v in warp_quality_config.items() ])
1792
1794
  if not set_resolution:
1793
- reproj_options = f'-tps -ts 0 {self.warp_output_height} -r bilinear -t_srs "EPSG:3857"'
1795
+ res_options = f'-ts 0 {self.warp_output_height}'
1794
1796
  else:
1795
1797
  res = self.get_resolution()
1796
1798
  if res == 'auto':
1797
- reproj_options = '-tps -r bilinear -t_srs "EPSG:3857"'
1799
+ res_options = ''
1798
1800
  else:
1799
1801
  if type(res) is not list:
1800
1802
  res = [res, res]
1801
- reproj_options = f'-tps -tr {res[0]} {res[1]} -r bilinear -t_srs "EPSG:3857"'
1803
+ res_options = f'-tr {res[0]} {res[1]}'
1804
+
1805
+ reproj_options = f'-tps {res_options} -r {self.warp_resampling_method} -t_srs "EPSG:3857"'
1802
1806
 
1803
1807
  #nodata_options = '-dstnodata 0'
1804
1808
  nodata_options = '-dstalpha'
@@ -1903,7 +1907,8 @@ class TopoMapProcessor:
1903
1907
  mask_options = '--config GDAL_TIFF_INTERNAL_MASK YES -b 1 -b 2 -b 3 -mask 4'
1904
1908
  perf_options = '--config GDAL_CACHEMAX 512'
1905
1909
  cog_options = '-of COG'
1906
- cmd = f'gdal_translate {perf_options} {mask_options} {creation_opts} {cog_options} {filename} {out_filename}'
1910
+ resampling_options = f'-r {self.export_resampling_method}'
1911
+ cmd = f'gdal_translate {perf_options} {mask_options} {creation_opts} {cog_options} {resampling_options} {filename} {out_filename}'
1907
1912
  self.run_external(cmd)
1908
1913
 
1909
1914
  def export(self):
@@ -8,6 +8,7 @@ from pathlib import Path
8
8
  from multiprocessing import set_start_method
9
9
 
10
10
  from pmtiles_mosaic.partition import partition_main
11
+ from release_tools.download_from_release import cli as download_from_release_main
11
12
 
12
13
  from .retile import retile_main
13
14
  from .create_force_redo_bounds import main as create_force_redo_bounds_main
@@ -112,15 +113,13 @@ def cli():
112
113
 
113
114
  # Download TIFFs
114
115
  print("Downloading TIFFs...")
115
- with open(sheets_to_pull_list_outfile) as f:
116
- for line in f:
117
- fname = line.strip()
118
- if fname:
119
- print(f"Pulling {fname}")
120
- try:
121
- run_command(["gh", "release", "download", args.gtiffs_release, "-p", fname, "-D", str(tiffs_dir), "--clobber"])
122
- except subprocess.CalledProcessError as e:
123
- print(f"Failed to download {fname}. It might be a dummy sheet from force redo. Continuing...")
116
+ # The download script will report if files are not found, which is expected for dummy sheets.
117
+ if download_from_release_main([
118
+ "--release", args.gtiffs_release,
119
+ "--output-dir", str(tiffs_dir),
120
+ "--file-list", str(sheets_to_pull_list_outfile),
121
+ ]) != 0:
122
+ print("Some TIFFs failed to download. This may be expected for dummy sheets from force redo. Continuing...", file=sys.stderr)
124
123
 
125
124
  sheets_to_pull_list_outfile.unlink()
126
125
 
@@ -143,6 +142,7 @@ def cli():
143
142
  "--from-source", str(tiles_dir),
144
143
  "--from-source", f"{from_pmtiles_prefix}*.pmtiles",
145
144
  "--to-pmtiles", f"{to_pmtiles_prefix}.pmtiles",
145
+ "--exclude-transparent"
146
146
  ])
147
147
 
148
148
  # Upload new PMTiles and manage release assets
@@ -175,4 +175,4 @@ def cli():
175
175
 
176
176
 
177
177
  if __name__ == "__main__":
178
- cli()
178
+ cli()