@@ -34,14 +34,36 @@ export default class ProjManager {
34
34
}
35
35
}
36
36
37
- // Get projection details from STAC (todo: add collection support)
38
- static async addFromStac ( stac ) {
39
- if ( Utils . isObject ( stac ) && Utils . isObject ( stac . properties ) ) {
40
- if ( stac . properties [ 'proj:epsg' ] ) {
41
- return await ProjManager . get ( stac . properties [ 'proj:epsg' ] ) ;
37
+ static async addFromStacItem ( stac ) {
38
+ if ( Utils . isObject ( stac ) ) {
39
+ return await this . addFromStacObject ( stac . properties , stac . id ) ;
40
+ }
41
+ return null ;
42
+ }
43
+ static async addFromStacCollection ( stac ) {
44
+ if ( Utils . isObject ( stac ) ) {
45
+ // Todo: Handle arrays in summaries...
46
+ // return await this.addFromStacObject(stac.summaries, stac.id);
47
+ }
48
+ return null ;
49
+ }
50
+
51
+ // Get projection details from STAC Asset
52
+ static async addFromStacAsset ( asset ) {
53
+ return await this . addFromStacObject ( asset , asset . href ) ;
54
+ }
55
+
56
+ // Get projection details from STAC Asset
57
+ static async addFromStacObject ( obj , id ) {
58
+ if ( Utils . isObject ( obj ) ) {
59
+ if ( obj [ 'proj:epsg' ] ) {
60
+ return await ProjManager . get ( obj [ 'proj:epsg' ] ) ;
61
+ }
62
+ else if ( obj [ 'equi7:proj' ] ) {
63
+ return ProjManager . add ( id , obj [ 'equi7:proj' ] ) ;
42
64
}
43
- else if ( stac . properties [ 'proj:wkt2' ] ) {
44
- return ProjManager . add ( stac . id , stac . properties [ 'proj:wkt2' ] ) ;
65
+ else if ( obj [ 'proj:wkt2' ] ) {
66
+ return ProjManager . add ( id , obj [ 'proj:wkt2' ] ) ;
45
67
}
46
68
}
47
69
return null ;
0 commit comments