smo_scottish_lidar 0.1.0 → 0.1.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -0
- data/LICENSE +21 -0
- data/lib/smo_scottish_lidar/client.rb +6 -4
- data/lib/smo_scottish_lidar/version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b1a88cb6ca3cdf48171294c64c21bbb3378f00e21827cf1351109bb45450c34e
|
|
4
|
+
data.tar.gz: 9b14f96be6226b88268ff3597538d155658355460230964d0f2999564008ea27
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b1290688d96f966da4dbf150a2f79a73010ad2ea43d8fe2f4a27583c24faf372b58a97a39e60dd1acc059d61c94a4e05865fceeb2f63975f6bcc832267300a14
|
|
7
|
+
data.tar.gz: 7a27520bb460a1a5a20dadcc1fec457a3988612d170be9058cc78a48d99b7a0010f2e066f942ccc5897d1a578e2e67dc487553d767a26e3e21593e2975e26428
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.0] - 2026-05-04
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- `SmoScottishLidar::Client` for listing and downloading LiDAR data from AWS S3
|
|
14
|
+
- Support for all survey phases (1–5) and Outer Hebrides
|
|
15
|
+
- DSM, DTM, and LAZ dataset types
|
|
16
|
+
- OS National Grid square filtering
|
|
17
|
+
- Paginated S3 listing with continuation tokens
|
|
18
|
+
- Streamed downloads with redirect following and progress callback
|
|
19
|
+
- Dry-run mode via verbose option
|
|
20
|
+
- RSpec test suite
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sebastian Madrid Ontiveros
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -8,6 +8,8 @@ module SmoScottishLidar
|
|
|
8
8
|
# Accesses the public (unsigned) srsp-open-data bucket directly over HTTPS.
|
|
9
9
|
class Client
|
|
10
10
|
MAX_KEYS = 1000
|
|
11
|
+
MSG_TOO_MANY_REDIRECTS = "Too many redirects"
|
|
12
|
+
MSG_NO_LOCATION_HEADER = "Redirect with no Location header"
|
|
11
13
|
|
|
12
14
|
def initialize(verbose: false)
|
|
13
15
|
@verbose = verbose
|
|
@@ -81,7 +83,7 @@ module SmoScottishLidar
|
|
|
81
83
|
end
|
|
82
84
|
|
|
83
85
|
def fetch_with_redirect(uri, local_path, redirects_remaining: 5, &progress_block)
|
|
84
|
-
raise
|
|
86
|
+
raise MSG_TOO_MANY_REDIRECTS if redirects_remaining.zero?
|
|
85
87
|
|
|
86
88
|
Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") do |http|
|
|
87
89
|
request = Net::HTTP::Get.new(uri.request_uri)
|
|
@@ -99,7 +101,7 @@ module SmoScottishLidar
|
|
|
99
101
|
end
|
|
100
102
|
when 301, 302, 307, 308
|
|
101
103
|
location = response["location"]
|
|
102
|
-
raise
|
|
104
|
+
raise MSG_NO_LOCATION_HEADER unless location
|
|
103
105
|
|
|
104
106
|
log "Redirect -> #{location}"
|
|
105
107
|
fetch_with_redirect(URI.parse(location), local_path,
|
|
@@ -113,7 +115,7 @@ module SmoScottishLidar
|
|
|
113
115
|
end
|
|
114
116
|
|
|
115
117
|
def get_response(uri, redirects_remaining: 5)
|
|
116
|
-
raise "
|
|
118
|
+
raise "#{MSG_TOO_MANY_REDIRECTS} listing #{uri}" if redirects_remaining.zero?
|
|
117
119
|
|
|
118
120
|
Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") do |http|
|
|
119
121
|
response = http.get(uri.request_uri)
|
|
@@ -122,7 +124,7 @@ module SmoScottishLidar
|
|
|
122
124
|
response
|
|
123
125
|
when 301, 302, 307, 308
|
|
124
126
|
location = response["location"]
|
|
125
|
-
raise
|
|
127
|
+
raise MSG_NO_LOCATION_HEADER unless location
|
|
126
128
|
|
|
127
129
|
log "Redirect -> #{location}"
|
|
128
130
|
get_response(URI.parse(location), redirects_remaining: redirects_remaining - 1)
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: smo_scottish_lidar
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sebastian Madrid Ontiveros
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-
|
|
10
|
+
date: 2026-06-10 00:00:00.000000000 Z
|
|
11
11
|
dependencies: []
|
|
12
12
|
description: |
|
|
13
13
|
Developed by Sebastian Madrid Ontiveros to support hydraulic modellers in Scotland
|
|
@@ -18,11 +18,14 @@ description: |
|
|
|
18
18
|
downloads with resume support, and dry-run mode. No external dependencies. Uses only
|
|
19
19
|
Ruby stdlib (net/http, uri, fileutils). If this gem saves you time, consider buying
|
|
20
20
|
Sebastian a coffee at https://buymeacoffee.com/smadrid
|
|
21
|
-
email:
|
|
21
|
+
email:
|
|
22
|
+
- sebasmadrid20@hotmail.com
|
|
22
23
|
executables: []
|
|
23
24
|
extensions: []
|
|
24
25
|
extra_rdoc_files: []
|
|
25
26
|
files:
|
|
27
|
+
- CHANGELOG.md
|
|
28
|
+
- LICENSE
|
|
26
29
|
- README.md
|
|
27
30
|
- lib/smo_scottish_lidar.rb
|
|
28
31
|
- lib/smo_scottish_lidar/client.rb
|