terriajs
Version:
Geospatial data visualization platform.
102 lines (95 loc) • 3.73 kB
text/typescript
import { JsonObject } from "../../Core/Json";
import anyTrait from "../Decorators/anyTrait";
import primitiveTrait from "../Decorators/primitiveTrait";
import { traitClass } from "../Trait";
import mixTraits from "../mixTraits";
import ArcGisPortalSharedTraits from "./ArcGisPortalSharedTraits";
import CatalogMemberTraits from "./CatalogMemberTraits";
import GroupTraits from "./GroupTraits";
import LegendOwnerTraits from "./LegendOwnerTraits";
import UrlTraits from "./UrlTraits";
({
description: `Creates a group with members from ArcGIS server portal.
<strong>Note:</strong>
<br>The following example will</br>
<li>Request datasets of specific types only.</li>
<li>Organise members in subgroups according to their categories.</li>
<li>Sort members according to their titles.</li>`,
example: {
url: "https://portal.spatial.nsw.gov.au/portal",
type: "arcgis-portal-group",
groupBy: "portalCategories",
name: "NSW Spatial Portal Categories",
searchParams: {
q: '(type:"Map Service" OR type:"WMS" OR type:"KML")',
sortField: "title"
},
id: "some id"
}
})
export default class ArcGisPortalCatalogGroupTraits extends mixTraits(
GroupTraits,
UrlTraits,
CatalogMemberTraits,
LegendOwnerTraits,
ArcGisPortalSharedTraits
) {
({
name: "Search Parameters",
description: `An object containing parameters matching the ArcGIS Rest API params, see https://developers.arcgis.com/rest/users-groups-and-items/search-reference.htm`
})
searchParams?: JsonObject = {
q: `(type:"Scene Service" OR
type:"Feature Service" OR
type:"Map Service" OR
type:"WMS" OR
type:"WFS" OR
type:"KML")`,
sortField: "title"
};
({
name: "Group Search Parameters",
description: `An object containing parameters to search by groups using the ArcGIS Rest API params, see https://developers.arcgis.com/rest/users-groups-and-items/group-search.htm
Note: this setting is only used when "groupBy" option is set to "organisationsGroups".
`
})
groupSearchParams?: JsonObject = {
q: `orgid:0123456789ABCDEF
(access:private OR access:org)
-owner:esri_nav
-owner:esri_livingatlas
-owner:esri_boundaries
-owner:esri_demographics
`,
searchUserAccess: "groupMember"
};
({
type: "string",
name: "Group By",
description: `Gets or sets a value indicating how datasets should be grouped. Valid values are:
* none - All available datasets are put in a flat list; they are not grouped at all.
* organisationsGroups - Data is retrieved and sorted by the organisations groups.
* portalCategories - Data is retrieved and sorted by categories specified by the portal items.
* usersGroups - Data is retrieved and sorted by the groups particular to the user.
* Note: This requires a user to be signed into portal, with a "portalUsername" to be set in "terria.userProperties", this is not available by default and requires custom configuration of TerriaMap.
`
})
groupBy?:
| "usersGroups"
| "organisationsGroups"
| "portalCategories"
| "none" = "none";
({
type: "string",
name: "Ungrouped title",
description: `A title for the group holding all items that don't have a group in an ArcGIS Portal.
If the value is a blank string or undefined, these items will be left at the top level, not grouped.`
})
ungroupedTitle: string = "Ungrouped";
({
type: "boolean",
name: "Hide empty groups",
description: `If a group has no items don't display it in the catalog`
})
hideEmptyGroups: boolean = true;
}