Skip to content

Commit

Permalink
Add 3 ESRI Layer types
Browse files Browse the repository at this point in the history
  • Loading branch information
ingalls committed Sep 27, 2024
1 parent 06b599c commit 2cf972b
Show file tree
Hide file tree
Showing 2 changed files with 180 additions and 117 deletions.
267 changes: 165 additions & 102 deletions api/lib/esri/layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import type { ESRILayer, ESRIField } from './types.js';
export default class Layer {
layers: Array<Static<typeof ESRILayer>>;

constructor(layers: Array<Static<typeof ESRILayer>> = [DefaultLayer]) {
constructor(layers: Array<Static<typeof ESRILayer>> = [
DefaultLayerPoints,
DefaultLayerLines,
DefaultLayerPolys,
]) {
this.layers = layers;
}

Expand All @@ -18,7 +22,165 @@ export default class Layer {
}
}

export const DefaultLayer: Static<typeof ESRILayer> = {

export const DefaultFields = [{
"name": "objectid",
"type": "esriFieldTypeOID",
"actualType": "int",
"alias": "fid",
"sqlType": "sqlTypeInteger",
"length": 4,
"nullable": false,
"editable": false,
"domain": null,
"defaultValue": null
},{
"name": "cotuid",
"type": "esriFieldTypeString",
"actualType": "nvarchar",
"alias": "cotuid1",
"sqlType": "sqlTypeNVarchar",
"length": 100,
"nullable": false,
"editable": true,
"domain": null,
"defaultValue": null
},{
"name": "remarks",
"type": "esriFieldTypeString",
"actualType": "nvarchar",
"alias": "remarks",
"sqlType": "sqlTypeNVarchar",
"length": 2000,
"nullable": false,
"editable": true,
"domain": null,
"defaultValue": null
},{
"name": "callsign",
"type": "esriFieldTypeString",
"actualType": "nvarchar",
"alias": "callsign",
"sqlType": "sqlTypeNVarchar",
"length": 100,
"nullable": true,
"editable": true,
"domain": null,
"defaultValue": null
},{
"name": "type",
"type": "esriFieldTypeString",
"actualType": "nvarchar",
"alias": "type",
"sqlType": "sqlTypeNVarchar",
"length": 100,
"nullable": true,
"editable": true,
"domain": null,
"defaultValue": null
},{
"name": "how",
"type": "esriFieldTypeString",
"actualType": "nvarchar",
"alias": "how",
"sqlType": "sqlTypeNVarchar",
"length": 100,
"nullable": true,
"editable": true,
"domain": null,
"defaultValue": null
},{
"name": "time",
"type": "esriFieldTypeDate",
"actualType": "datetime2",
"alias": "time",
"sqlType": "sqlTypeTimestamp2",
"length": 100,
"nullable": true,
"editable": true,
"domain": null,
"defaultValue": null
},{
"name": "start",
"type": "esriFieldTypeDate",
"actualType": "datetime2",
"alias": "start",
"sqlType": "sqlTypeTimestamp2",
"length": 100,
"nullable": true,
"editable": true,
"domain": null,
"defaultValue": null
},{
"name": "stale",
"type": "esriFieldTypeDate",
"actualType": "datetime2",
"alias": "stale",
"sqlType": "sqlTypeTimestamp2",
"length": 100,
"nullable": true,
"editable": true,
"domain": null,
"defaultValue": null
}]

export const DefaultLayerPolys: Static<typeof ESRILayer> = {
id: 2,
name: 'TAK ETL Polys',
description: 'CoT message Polys',
type: 'Feature Layer',
displayField: 'callsign',
supportedQueryFormats: 'JSON',
capabilities: "Create,Delete,Query,Update,Editing,Extract,Sync",
geometryType: 'esriGeometryPolygon',
allowGeometryUpdates: true,
hasAttachments: false,
hasM: false,
hasZ: false,
objectIdField: 'objectid',
extent: {
xmin: -20037508.34,
ymin: -20048966.1,
xmax: 20037508.34,
ymax: 20048966.1,
spatialReference: { wkid: 102100, latestWkid: 3857 },
},
uniqueIdField: {
name: "objectid",
isSystemMaintained: true
},
fields: DefaultFields
}

export const DefaultLayerLines: Static<typeof ESRILayer> = {
id: 1,
name: 'TAK ETL Lines',
description: 'CoT message Lines',
type: 'Feature Layer',
displayField: 'callsign',
supportedQueryFormats: 'JSON',
capabilities: "Create,Delete,Query,Update,Editing,Extract,Sync",
geometryType: 'esriGeometryLine',
allowGeometryUpdates: true,
hasAttachments: false,
hasM: false,
hasZ: false,
objectIdField: 'objectid',
extent: {
xmin: -20037508.34,
ymin: -20048966.1,
xmax: 20037508.34,
ymax: 20048966.1,
spatialReference: { wkid: 102100, latestWkid: 3857 },
},
uniqueIdField: {
name: "objectid",
isSystemMaintained: true
},
fields: DefaultFields
}

export const DefaultLayerPoints: Static<typeof ESRILayer> = {
id: 0,
name: 'TAK ETL Points',
description: 'CoT message Points',
Expand All @@ -43,104 +205,5 @@ export const DefaultLayer: Static<typeof ESRILayer> = {
name: "objectid",
isSystemMaintained: true
},
fields: [{
"name": "objectid",
"type": "esriFieldTypeOID",
"actualType": "int",
"alias": "fid",
"sqlType": "sqlTypeInteger",
"length": 4,
"nullable": false,
"editable": false,
"domain": null,
"defaultValue": null
},{
"name": "cotuid",
"type": "esriFieldTypeString",
"actualType": "nvarchar",
"alias": "cotuid1",
"sqlType": "sqlTypeNVarchar",
"length": 100,
"nullable": false,
"editable": true,
"domain": null,
"defaultValue": null
},{
"name": "remarks",
"type": "esriFieldTypeString",
"actualType": "nvarchar",
"alias": "remarks",
"sqlType": "sqlTypeNVarchar",
"length": 2000,
"nullable": false,
"editable": true,
"domain": null,
"defaultValue": null
},{
"name": "callsign",
"type": "esriFieldTypeString",
"actualType": "nvarchar",
"alias": "callsign",
"sqlType": "sqlTypeNVarchar",
"length": 100,
"nullable": true,
"editable": true,
"domain": null,
"defaultValue": null
},{
"name": "type",
"type": "esriFieldTypeString",
"actualType": "nvarchar",
"alias": "type",
"sqlType": "sqlTypeNVarchar",
"length": 100,
"nullable": true,
"editable": true,
"domain": null,
"defaultValue": null
},{
"name": "how",
"type": "esriFieldTypeString",
"actualType": "nvarchar",
"alias": "how",
"sqlType": "sqlTypeNVarchar",
"length": 100,
"nullable": true,
"editable": true,
"domain": null,
"defaultValue": null
},{
"name": "time",
"type": "esriFieldTypeDate",
"actualType": "datetime2",
"alias": "time",
"sqlType": "sqlTypeTimestamp2",
"length": 100,
"nullable": true,
"editable": true,
"domain": null,
"defaultValue": null
},{
"name": "start",
"type": "esriFieldTypeDate",
"actualType": "datetime2",
"alias": "start",
"sqlType": "sqlTypeTimestamp2",
"length": 100,
"nullable": true,
"editable": true,
"domain": null,
"defaultValue": null
},{
"name": "stale",
"type": "esriFieldTypeDate",
"actualType": "datetime2",
"alias": "stale",
"sqlType": "sqlTypeTimestamp2",
"length": 100,
"nullable": true,
"editable": true,
"domain": null,
"defaultValue": null
}]
fields: DefaultFields
}
30 changes: 15 additions & 15 deletions api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2cf972b

Please sign in to comment.