Skip to content

Commit dc9e860

Browse files
authored
Merge pull request #204 from stac-utils/fix/rde/collection-set-href-recursion
Fix issue that can cause infinite recursion during full resolve
2 parents eaf8b42 + e105c4c commit dc9e860

File tree

11 files changed

+867
-7
lines changed

11 files changed

+867
-7
lines changed

pystac/collection.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,14 @@ def set_self_href(self, href):
9494
Overridden for collections so that the root's ResolutionObjectCache can properly
9595
update the HREF cache.
9696
"""
97-
root = self.get_root()
98-
if root is not None:
99-
root._resolved_objects.remove(self)
97+
root_link = self.get_root_link()
98+
if root_link is not None and root_link.is_resolved():
99+
root_link.target._resolved_objects.remove(self)
100100

101101
super().set_self_href(href)
102102

103-
if root is not None:
104-
root._resolved_objects.cache(self)
103+
if root_link is not None and root_link.is_resolved():
104+
root_link.target._resolved_objects.cache(self)
105105

106106
return self
107107

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
{
2+
"id": "planet-disaster-data",
3+
"stac_version": "1.0.0-beta.2",
4+
"description": "[Planet Disaster Data](https://www.planet.com/disasterdata/) makes imagery available directly to the public, volunteers, humanitarian organizations, and other coordinating bodies in support of the International Charter for Space and Major Disasters. Data is released for individual disaster events, providing a 30 day window pre- and post-disaster. Imagery is provided under Creative Commons licenses, free of charge, with either CC-BY-SA or CC-BY-NC.",
5+
"links": [
6+
{
7+
"rel": "root",
8+
"href": "./collection.json",
9+
"type": "application/json"
10+
},
11+
{
12+
"rel": "child",
13+
"href": "./hurricane-harvey/catalog.json",
14+
"title": "Hurricane Harvey"
15+
}
16+
],
17+
"title": "Planet Disaster Data",
18+
"keywords": [
19+
"disaster",
20+
"open"
21+
],
22+
"providers": [
23+
{
24+
"name": "Planet",
25+
"description": "Contact Planet at [planet.com/contact-sales](https://www.planet.com/contact-sales/)",
26+
"roles": [
27+
"producer",
28+
"processor"
29+
],
30+
"url": "http://planet.com"
31+
},
32+
{
33+
"name": "Planet Disaster Team",
34+
"description": "The Planet Disaster Data Team (<disaster-team@planet.com>) has released this data as CC-BY-SA-4.0 to help disaster response",
35+
"roles": [
36+
"licensor"
37+
],
38+
"url": "https://www.planet.com/disasterdata/"
39+
},
40+
{
41+
"name": "GitHub",
42+
"description": "This catalog is hosted in the [sample-stac](https://github.com/cholmes/sample-stac) repository on GitHub",
43+
"roles": [
44+
"host"
45+
],
46+
"url": "https://github.com"
47+
}
48+
],
49+
"summaries": {
50+
"constellation": [
51+
"skysat",
52+
"planetscope"
53+
],
54+
"platform": [
55+
"SS02",
56+
"SSC1",
57+
"101c"
58+
],
59+
"view:off_nadir": {
60+
"min": 0.2,
61+
"max": 27.3
62+
},
63+
"view:sun_elevation": {
64+
"min": 56.3,
65+
"max": 65.1
66+
},
67+
"view:sun_azimuth": {
68+
"min": 122,
69+
"max": 231.9
70+
},
71+
"eo:gsd": {
72+
"min": 0.9,
73+
"max": 3.7
74+
},
75+
"eo:cloud_cover": {
76+
"min": 0,
77+
"max": 24
78+
}
79+
},
80+
"extent": {
81+
"spatial": {
82+
"bbox": [
83+
[
84+
-96,
85+
28,
86+
-93,
87+
31
88+
]
89+
]
90+
},
91+
"temporal": {
92+
"interval": [
93+
[
94+
"2017-08-28T10:00:00-08:00",
95+
null
96+
]
97+
]
98+
}
99+
},
100+
"license": "CC-BY-SA-4.0"
101+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"id": "hurricane-harvey",
3+
"stac_version": "1.0.0-beta.2",
4+
"description": "Planet Disaster Data makes imagery available directly to the public, volunteers, humanitarian organizations, and other coordinating bodies in support of the International Charter for Space and Major Disasters. This catalog of data is released for Hurricane Harvey, providing a 30 day window pre- and post-disaster. Imagery is provided under Creative Commons licenses, free of charge, with either CC-BY-SA or CC-BY-NC. All new Planet scenes are made available each day, immediately after production. ",
5+
"links": [
6+
{
7+
"rel": "root",
8+
"href": "../collection.json",
9+
"type": "application/json"
10+
},
11+
{
12+
"rel": "parent",
13+
"href": "../collection.json",
14+
"type": "application/json"
15+
},
16+
{
17+
"rel": "child",
18+
"href": "./hurricane-harvey-0831/catalog.json",
19+
"title": "8/31"
20+
}
21+
],
22+
"title": "Hurricane Harvey"
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
{
2+
"type": "Feature",
3+
"stac_version": "1.0.0-beta.2",
4+
"id": "20170831_162740_ssc1d1",
5+
"properties": {
6+
"datetime": "2017-08-31T16:27:42.176605Z",
7+
"platform": "SSC1",
8+
"constellation": "skysat",
9+
"updated": "2017-11-01T21:09:02Z",
10+
"created": "2017-09-01T19:37:35Z",
11+
"gsd": 0.9,
12+
"eo:cloud_cover": 0,
13+
"view:azimuth": 121.3,
14+
"view:sun_azimuth": 122,
15+
"view:sun_elevation": 56.3,
16+
"view:off_nadir": 27.2,
17+
"pl:ground_control": true,
18+
"pl:item_type": "SkySatScene",
19+
"pl:quality_category": "standard",
20+
"pl:strip_id": "s03_20170831T162740Z"
21+
},
22+
"geometry": {
23+
"type": "Polygon",
24+
"coordinates": [
25+
[
26+
[
27+
-95.46998977661133,
28+
29.059245820517656
29+
],
30+
[
31+
-95.46990394592285,
32+
29.049491960581708
33+
],
34+
[
35+
-95.44741630554199,
36+
29.03215782622282
37+
],
38+
[
39+
-95.46647071838379,
40+
29.01797318720572
41+
],
42+
[
43+
-95.46561241149902,
44+
29.016997452585333
45+
],
46+
[
47+
-95.46509742736816,
48+
29.017072509421837
49+
],
50+
[
51+
-95.44072151184082,
52+
28.997931250084207
53+
],
54+
[
55+
-95.28116226196289,
56+
28.872261720487128
57+
],
58+
[
59+
-95.26768684387207,
60+
28.87241204397036
61+
],
62+
[
63+
-95.25609970092773,
64+
28.884888134910938
65+
],
66+
[
67+
-95.28794288635254,
68+
28.910737431999245
69+
],
70+
[
71+
-95.27498245239258,
72+
28.924335785215973
73+
],
74+
[
75+
-95.24365425109863,
76+
28.89969215375586
77+
],
78+
[
79+
-95.23927688598633,
80+
28.90405029511776
81+
],
82+
[
83+
-95.23979187011719,
84+
28.929143616007288
85+
],
86+
[
87+
-95.26897430419922,
88+
28.951677350293465
89+
],
90+
[
91+
-95.35978317260742,
92+
29.022626563968657
93+
],
94+
[
95+
-95.4081916809082,
96+
29.061796677850424
97+
],
98+
[
99+
-95.42673110961913,
100+
29.048441489877778
101+
],
102+
[
103+
-95.44741630554199,
104+
29.064872627755797
105+
],
106+
[
107+
-95.46260833740233,
108+
29.06442249447776
109+
],
110+
[
111+
-95.46998977661133,
112+
29.059245820517656
113+
]
114+
]
115+
]
116+
},
117+
"links": [
118+
{
119+
"rel": "collection",
120+
"href": "../../../collection.json"
121+
},
122+
{
123+
"rel": "root",
124+
"href": "../../../collection.json",
125+
"type": "application/json"
126+
},
127+
{
128+
"rel": "parent",
129+
"href": "../catalog.json",
130+
"type": "application/json"
131+
}
132+
],
133+
"assets": {
134+
"thumbnail": {
135+
"href": "https://storage.googleapis.com/pdd-stac/disasters/hurricane-harvey/0831/SkySat_Freeport_s03_20170831T162740Z.png",
136+
"type": "image/png",
137+
"title": "Thumbnail",
138+
"roles": [
139+
"thumbnail"
140+
]
141+
},
142+
"visual": {
143+
"href": "https://storage.googleapis.com/pdd-stac/disasters/hurricane-harvey/0831/SkySat_Freeport_s03_20170831T162740Z.tif",
144+
"type": "image/vnd.stac.geotiff; cloud-optimized=true",
145+
"title": "SkySatScene Visual GeoTIFF",
146+
"pl:type": "https://api.planet.com/data/v1/asset-types/ortho_visual",
147+
"roles": [
148+
"data"
149+
]
150+
}
151+
},
152+
"bbox": [
153+
-95.46998977661133,
154+
28.872261720487128,
155+
-95.23927688598633,
156+
29.064872627755797
157+
],
158+
"stac_extensions": [
159+
"eo",
160+
"view"
161+
],
162+
"collection": "planet-disaster-data"
163+
}

0 commit comments

Comments
 (0)