Skip to content

Commit b5c065a

Browse files
#678 Support url prefix sourceType dropdowns (#680)
1 parent a4334d7 commit b5c065a

File tree

3 files changed

+42
-7
lines changed

3 files changed

+42
-7
lines changed

configure/src/metaconfigs/layer-tile-config.json

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,22 @@
4747
]
4848
},
4949
{
50+
"subname": "Source",
5051
"components": [
52+
{
53+
"field": "sourceType",
54+
"name": "Source Type",
55+
"description": "What the 'Source URL' is meant to reference. See the 'Source URL' description for more.",
56+
"type": "dropdown",
57+
"width": 2,
58+
"options": ["url", "COG", "stac-collection"]
59+
},
5160
{
5261
"field": "url",
53-
"name": "URL",
54-
"description": "A path that points to a tileset, service, or file. If the path is relative, it will be relative to the mission's /Missions/{mission} directory.\n\t<strong>• TMS:</strong> Tile Map Service tiles are 256x256 sized images hierarchically organized by zoom level and referenced with x and y coordinates. These are the standard format for web tiles and are the format that MMGIS's auxiliary tiling scripts output. Append /{z}/{x}/{y}.png to your URL.\n\t<strong>• WMTS:</strong> Web Map Tile Service is the same exact concept as TMS but it has an inverted Y-axis. Just like TMS, append /{z}/{x}/{y}.png to your URL.\n\t<strong>• WMS:</strong> Web Map Service tiles are a popular way of publishing maps by professional GIS software. This format is similar to the previous two formats, but more generic and not so well optimized for use in web maps. A WMS image is defined by the coordinates of its corners. A layer (or list of layers) should be provided as an options by appending ?layers=<your_layer_name><,another_if_you _want> to your URL. To override WMS parameters append &<wms_param>=<value> again to the URL after the 'layers' parameters. If desired, use &TILESIZE= to change the tile size of the request and layer away from the default of 256. Example URL: http://ows.mundialis.de/services/service?layers=TOPO-WMS,OSM-Overlay-WMS\n\t<strong>• GeoTiff:</strong> A URL to the .tif. Note that this is not tiled and clients will download the entire file.\n\t<strong>• COG:</strong> A URL to the .tif and make sure the 'Use TiTiler' option is enabled.\nThe following constructed URLs can also be used:\n\t<strong>• 'stac-collection:{collection}'</strong> - If titiler-pgstac is available, the tileset is the mosaicked COGs within the specified STAC collection.",
62+
"name": "Source URL",
63+
"description": "<strong>• URL: '{url}'</strong> A path that points to a tileset, service, or file. If the path is relative, it will be relative to the mission's /Missions/{mission} directory.\n\t<strong>• URL (TMS):</strong> Tile Map Service tiles are 256x256 sized images hierarchically organized by zoom level and referenced with x and y coordinates. These are the standard format for web tiles and are the format that MMGIS's auxiliary tiling scripts output. Append /{z}/{x}/{y}.png to your URL.\n\t<strong>• URL (WMTS):</strong> Web Map Tile Service is the same exact concept as TMS but it has an inverted Y-axis. Just like TMS, append /{z}/{x}/{y}.png to your URL.\n\t<strong>• URL (WMS):</strong> Web Map Service tiles are a popular way of publishing maps by professional GIS software. This format is similar to the previous two formats, but more generic and not so well optimized for use in web maps. A WMS image is defined by the coordinates of its corners. A layer (or list of layers) should be provided as an options by appending ?layers=<your_layer_name><,another_if_you _want> to your URL. To override WMS parameters append &<wms_param>=<value> again to the URL after the 'layers' parameters. If desired, use &TILESIZE= to change the tile size of the request and layer away from the default of 256. Example URL: http://ows.mundialis.de/services/service?layers=TOPO-WMS,OSM-Overlay-WMS\n\t<strong>• URL (GeoTiff): '{url_to_tif.tif}'</strong> A URL to the .tif. Note that this is not tiled and clients will download the entire file.\n<strong>• COG: '{url_to_cog.tif}'</strong> A URL to the .tif and make sure the 'Use TiTiler' option is enabled.\n<strong>• 'STAC-COLLECTION: '{name_of_an_mmgis_stac_collection}'</strong> - If titiler-pgstac is available, the tileset is the mosaicked COGs within the specified STAC collection.",
5564
"type": "text",
56-
"width": 8
65+
"width": 6
5766
}
5867
]
5968
},

configure/src/metaconfigs/layer-vector-config.json

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,30 @@
5757
]
5858
},
5959
{
60+
"subname": "Source",
6061
"components": [
62+
{
63+
"field": "sourceType",
64+
"name": "Source Type",
65+
"description": "What the 'Source URL' is meant to reference. See the 'Source URL' description for more.",
66+
"type": "dropdown",
67+
"width": 2,
68+
"options": [
69+
"url",
70+
"geodatasets",
71+
"api",
72+
"stac",
73+
"stac-catalog",
74+
"stac-collection",
75+
"stac-item"
76+
]
77+
},
6178
{
6279
"field": "url",
63-
"name": "URL",
64-
"description": "A file path that points to a geojson. If the path is relative, it will be relative to the mission's directory. The URL must contain a proper placeholder ending such as: {z}/{x}/{y}.png.\nAlternatively vectors can be served with Geodatasets or through API calls via the following constructed URLs:\n\t<strong>• 'geodatasets:{geodataset_name}'</strong> - Simply go to 'Manage Geodatasets' at the bottom left, upload a geojson and link to it in this URL field with 'geodatasets:{geodataset_name}'\n\t<strong>• 'api:publishedall'</strong> - Grabs all features published via the DrawTool.\n\t<strong>• 'api:published:{file_intent}'</strong> - Grabs all features published via the DrawTool of a certain intent. Possible values are: roi, campaign, campsite, signpost, trail, all\n\t<strong>• 'api:drawn:{file_id}'</strong> - Grabs a user drawn file from the DrawTool. The file_id is an integer and can be found by hovering over the desired file in the DrawTool. Note that if the file chosen is still private, the file owner will be the only user who can view it.",
80+
"name": "Source URL",
81+
"description": "<strong>\t• URL: '{url}' - A file path that points to a geojson. If the path is relative, it will be relative to the mission's directory.\n\t<strong>• GeoDatasets: '{geodataset_name}'</strong> - Simply go to 'Manage Geodatasets' at the bottom left, upload a geojson and link to it in this URL field with '{geodataset_name}'\n\t<strong>• API: 'publishedall'</strong> - Grabs all features published via the DrawTool.\n\t<strong>• API: 'published:{file_intent}'</strong> - Grabs all features published via the DrawTool of a certain intent. Possible values are: roi, campaign, campsite, signpost, trail, all\n\t<strong>• API: 'drawn:{file_id}'</strong> - Grabs a user drawn file from the DrawTool. The file_id is an integer and can be found by hovering over the desired file in the DrawTool. Note that if the file chosen is still private, the file owner will be the only user who can view it.\n\t<strong>• STAC: '{url_to_stac}'</strong> - Point to a STAC catalog/collection/item of GeoJSON features.\n\t<strong>• STAC-CATALOG: '{url_to_stac_catalog}'</strong> - Use this prefix if the URL is specifically to a Catalog object.\n\t<strong>• STAC-COLLECTION: '{url_to_stac_collection}'</strong> - Use this prefix if the URL is specifically to a Collection object.\n\t<strong>• STAC-ITEM: '{url_to_stac_item}'</strong> - Use this prefix if the URL is to an Item object\n\t\t• If the underlying data is a COG or similar data product, use the <strong>Tile</strong> layer type instead.",
6582
"type": "text",
66-
"width": 12
83+
"width": 10
6784
}
6885
]
6986
},

src/essence/Basics/Layers_/Layers_.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3640,7 +3640,16 @@ function parseConfig(configData, urlOnLayers) {
36403640
d[i] = { display_name: d[i].name, ...d[i] }
36413641
d[i].name = d[i].uuid || d[i].name
36423642

3643-
//Create parsed layers named
3643+
// If sourceType, prefix onto url
3644+
if (
3645+
d[i].sourceType != null &&
3646+
d[i].sourceType !== 'url' &&
3647+
d[i].url.indexOf(`${d[i].sourceType}:`) !== 0
3648+
) {
3649+
d[i].url = `${d[i].sourceType}:${d[i].url}`
3650+
}
3651+
3652+
// Create parsed layers named
36443653
L_.layers.data[d[i].name] = d[i]
36453654

36463655
if (d[i].display_name === 'TimeCogs') {

0 commit comments

Comments
 (0)