Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Asc Geostac
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
aflab
astrogeology
Asc Geostac
Commits
776ac91e
Commit
776ac91e
authored
1 year ago
by
zksx
Browse files
Options
Downloads
Patches
Plain Diff
added some stuff for styling
parent
16df93f7
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/components/presentational/FootprintResults.jsx
+26
-1
26 additions, 1 deletion
src/components/presentational/FootprintResults.jsx
src/js/AstroMap.js
+16
-15
16 additions, 15 deletions
src/js/AstroMap.js
src/js/FetchData.js
+1
-1
1 addition, 1 deletion
src/js/FetchData.js
with
43 additions
and
17 deletions
src/components/presentational/FootprintResults.jsx
+
26
−
1
View file @
776ac91e
...
@@ -119,6 +119,8 @@ export default function FootprintResults(props) {
...
@@ -119,6 +119,8 @@ export default function FootprintResults(props) {
}
}
let
collectionUrls
=
{};
let
collectionUrls
=
{};
let
styleSheetUrls
=
[];
for
(
const
collection
of
props
.
target
.
collections
)
{
for
(
const
collection
of
props
.
target
.
collections
)
{
...
@@ -133,15 +135,37 @@ export default function FootprintResults(props) {
...
@@ -133,15 +135,37 @@ export default function FootprintResults(props) {
// change filter for the pygeo api
// change filter for the pygeo api
myFilter
=
"
&limit=
"
+
step
;
myFilter
=
"
&limit=
"
+
step
;
}
}
let
styleSheet
;
const
foundStyleSheet
=
collection
.
links
.
find
(
link
=>
link
.
rel
==
"
stylesheet
"
);
if
(
foundStyleSheet
)
{
styleSheet
=
foundStyleSheet
.
href
;
styleSheetUrls
[
collection
.
id
]
=
styleSheet
;
console
.
log
(
"
Found Style Sheet
"
);
}
if
(
isInStacAPI
||
isInPyAPI
)
{
if
(
isInStacAPI
||
isInPyAPI
)
{
let
itemsUrl
=
collection
.
links
.
find
(
link
=>
link
.
rel
===
"
items
"
).
href
;
let
itemsUrl
=
collection
.
links
.
find
(
link
=>
link
.
rel
===
"
items
"
).
href
;
collectionUrls
[
collection
.
id
]
=
itemsUrl
+
myFilter
+
pageInfo
;
collectionUrls
[
collection
.
id
]
=
itemsUrl
+
myFilter
+
pageInfo
;
let
style_url
=
null
;
for
(
let
index
=
0
;
index
<
collection
.
links
.
length
;
index
++
)
{
if
(
collection
.
links
[
index
].
rel
===
"
stylesheet
"
)
{
style_url
=
collection
.
links
[
index
].
href
}
}
collectionUrls
[
collection
.
id
+
"
: stylesheet
"
]
=
style_url
;
// if (collection.links.find(link => link.rel === "stylesheet").href != undefined) {
// let styleUrl = collection.links.find(link => link.rel === "stylesheet").href;
// collectionUrls[collection.id].style = styleUrl;
// }
// }
}
}
else
{
else
{
let
itemsUrl
=
collection
.
links
.
find
(
link
=>
link
.
rel
===
"
items
"
).
href
;
let
itemsUrl
=
collection
.
links
.
find
(
link
=>
link
.
rel
===
"
items
"
).
href
;
collectionUrls
[
collection
.
id
]
=
itemsUrl
+
pageInfo
;
collectionUrls
[
collection
.
id
]
=
itemsUrl
+
pageInfo
;
}
}
}
}
...
@@ -153,6 +177,7 @@ export default function FootprintResults(props) {
...
@@ -153,6 +177,7 @@ export default function FootprintResults(props) {
collections
[
key
].
id
=
key
;
collections
[
key
].
id
=
key
;
collections
[
key
].
title
=
props
.
target
.
collections
.
find
(
collection
=>
collection
.
id
===
key
).
title
;
collections
[
key
].
title
=
props
.
target
.
collections
.
find
(
collection
=>
collection
.
id
===
key
).
title
;
collections
[
key
].
url
=
collectionUrls
[
key
];
collections
[
key
].
url
=
collectionUrls
[
key
];
collections
[
key
].
styleSheets
=
styleSheetUrls
[
key
];
}
}
// Updates collectionId if switching to a new set of collections (new target)
// Updates collectionId if switching to a new set of collections (new target)
...
...
This diff is collapsed.
Click to expand it.
src/js/AstroMap.js
+
16
−
15
View file @
776ac91e
...
@@ -2,7 +2,8 @@ import L from "leaflet";
...
@@ -2,7 +2,8 @@ import L from "leaflet";
import
"
proj4leaflet
"
;
import
"
proj4leaflet
"
;
import
AstroProj
from
"
./AstroProj
"
;
import
AstroProj
from
"
./AstroProj
"
;
import
LayerCollection
from
"
./LayerCollection
"
;
import
LayerCollection
from
"
./LayerCollection
"
;
import
SLDText
from
"
../slds/Global_Geology.sld
"
;
import
FecthData
from
"
./FetchData
"
;
import
{
data
}
from
"
autoprefixer
"
;
/**
/**
...
@@ -58,8 +59,7 @@ export default L.Map.AstroMap = L.Map.extend({
...
@@ -58,8 +59,7 @@ export default L.Map.AstroMap = L.Map.extend({
// Set by layer collection or baselayerchange event
// Set by layer collection or baselayerchange event
this
.
_currentLayer
=
null
;
this
.
_currentLayer
=
null
;
this
.
SLDStyler
=
new
L
.
SLDStyler
(
SLDText
);
this
.
SLDStyler
=
new
L
.
SLDStyler
();
// Store layers at map creation so we only need to create layers once.
// Store layers at map creation so we only need to create layers once.
let
cylLayerInfo
=
this
.
parseJSON
(
"
cylindrical
"
);
let
cylLayerInfo
=
this
.
parseJSON
(
"
cylindrical
"
);
...
@@ -302,26 +302,27 @@ export default L.Map.AstroMap = L.Map.extend({
...
@@ -302,26 +302,27 @@ export default L.Map.AstroMap = L.Map.extend({
let
title
=
featureCollections
[
i
].
title
;
let
title
=
featureCollections
[
i
].
title
;
let
sld_file
=
featureCollections
[
i
].
styleSheets
;
// set style if available
let
myStyle
=
null
;
// Add each _geoLayer that has footprints to the FootprintCollection object.
// Add each _geoLayer that has footprints to the FootprintCollection object.
// The collection title is used as the property name
// The collection title is used as the property name
// [old] and it shows up as the layer title when added to the separate Leaflet control
// [old] and it shows up as the layer title when added to the separate Leaflet control
if
(
featureCollections
[
i
].
features
.
length
>
0
)
{
if
(
featureCollections
[
i
].
features
.
length
>
0
)
{
let
found_stylesheet
=
false
;
let
sld_file
=
null
;
// set style if available
for
(
let
j
=
0
;
j
<
featureCollections
[
i
].
links
.
length
;
j
++
)
{
if
(
featureCollections
[
i
].
links
[
j
].
rel
==
"
stylesheet
"
)
{
found_stylesheet
=
true
;
sld_file
=
fetch
(
featureCollections
[
i
].
links
[
j
].
href
);
this
.
SLDStyler
=
new
L
.
SLDStyler
(
sld_file
);
}
}
let
myStyle
=
null
;
if
(
found_stylesheet
)
{
if
(
sld_file
)
{
let
sldtext
=
fetch
(
sld_file
);
let
res
=
sldtext
.
res
console
.
log
(
"
good style wow
"
);
this
.
SLDStyler
=
new
L
.
SLDStyler
(
sldtext
);
myStyle
=
this
.
SLDStyler
.
getStyleFunction
();
myStyle
=
this
.
SLDStyler
.
getStyleFunction
();
}
}
else
{
else
{
// Set colors if available
// Set colors if available
...
...
This diff is collapsed.
Click to expand it.
src/js/FetchData.js
+
1
−
1
View file @
776ac91e
...
@@ -122,7 +122,7 @@ export default async function Initialize(){
...
@@ -122,7 +122,7 @@ export default async function Initialize(){
// view the collection as GEOJSON
// view the collection as GEOJSON
let
target_name
=
pycollection
.
id
.
split
(
'
/
'
)[
0
];
let
target_name
=
pycollection
.
id
.
split
(
'
/
'
)[
0
];
if
(
target
.
name
==
target_name
.
toUpperCase
())
{
if
(
target
.
name
==
target_name
.
toUpperCase
())
{
pycollection
.
links
[
9
]
.
href
=
"
https://astrogeology.usgs.gov/pygeoapi
"
+
pycollection
.
links
[
9
]
.
href
;
pycollection
.
links
.
find
(
link
=>
link
.
rel
===
"
items
"
)
.
href
=
"
https://astrogeology.usgs.gov/pygeoapi
"
+
pycollection
.
links
.
find
(
link
=>
link
.
rel
===
"
items
"
)
.
href
;
// Add a specification to the title in order to show what kind of data the user is requesting
// Add a specification to the title in order to show what kind of data the user is requesting
pycollection
.
title
=
pycollection
.
title
.
concat
(
"
(Vector)
"
);
pycollection
.
title
=
pycollection
.
title
.
concat
(
"
(Vector)
"
);
myCollections
.
push
(
pycollection
);
myCollections
.
push
(
pycollection
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment