@jupytergis/schema 0.13.2 → 0.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/doc.d.ts CHANGED
@@ -3,8 +3,12 @@ import { JSONObject } from '@lumino/coreutils';
3
3
  import { ISignal } from '@lumino/signaling';
4
4
  import { IJGISLayer, IJGISLayerItem, IJGISLayerTree, IJGISLayers, IJGISOptions, IJGISSource, IJGISSources, IJGISStoryMap } from './_interface/project/jgis';
5
5
  import { IDict, IJGISLayerDocChange, IJGISLayerTreeDocChange, IJGISSourceDocChange, IJGISStoryMapDocChange, IJGISStoryMaps, IJupyterGISDoc, IJupyterGISDocChange } from './interfaces';
6
+ /** Default JSON content for a new JupyterGIS document. */
7
+ export declare const DEFAULT_JGIS_DOCUMENT_CONTENT = "{\n\t\"schemaVersion\": \"0.5.0\",\n\t\"layers\": {},\n\t\"sources\": {},\n\t\"options\": {\"latitude\": 0, \"longitude\": 0, \"zoom\": 0, \"bearing\": 0, \"pitch\": 0, \"projection\": \"EPSG:3857\"},\n\t\"layerTree\": [],\n\t\"metadata\": {}\n}";
6
8
  export declare class JupyterGISDoc extends YDocument<IJupyterGISDocChange> implements IJupyterGISDoc {
7
9
  constructor();
10
+ get initialSyncReady(): Promise<void>;
11
+ private _onOptionsObserverFired;
8
12
  getSource(): JSONObject;
9
13
  setSource(value: JSONObject | string): void;
10
14
  dispose(): void;
@@ -74,4 +78,7 @@ export declare class JupyterGISDoc extends YDocument<IJupyterGISDocChange> imple
74
78
  private _sourcesChanged;
75
79
  private _storyMapsChanged;
76
80
  private _metadataChanged;
81
+ private _initialSyncReadyPromise;
82
+ private _initialSyncReadyResolve;
83
+ private _initialSyncResolved;
77
84
  }
package/lib/doc.js CHANGED
@@ -2,6 +2,15 @@ import { YDocument } from '@jupyter/ydoc';
2
2
  import { JSONExt } from '@lumino/coreutils';
3
3
  import { Signal } from '@lumino/signaling';
4
4
  import { SCHEMA_VERSION } from './_interface/version';
5
+ /** Default JSON content for a new JupyterGIS document. */
6
+ export const DEFAULT_JGIS_DOCUMENT_CONTENT = `{
7
+ "schemaVersion": "${SCHEMA_VERSION}",
8
+ "layers": {},
9
+ "sources": {},
10
+ "options": {"latitude": 0, "longitude": 0, "zoom": 0, "bearing": 0, "pitch": 0, "projection": "EPSG:3857"},
11
+ "layerTree": [],
12
+ "metadata": {}
13
+ }`;
5
14
  export class JupyterGISDoc extends YDocument {
6
15
  constructor() {
7
16
  super();
@@ -16,6 +25,7 @@ export class JupyterGISDoc extends YDocument {
16
25
  });
17
26
  });
18
27
  this._optionsChanged.emit(changes);
28
+ this._onOptionsObserverFired();
19
29
  };
20
30
  this._metaObserver = (event) => {
21
31
  const changes = new Map();
@@ -34,6 +44,7 @@ export class JupyterGISDoc extends YDocument {
34
44
  this._sourcesChanged = new Signal(this);
35
45
  this._storyMapsChanged = new Signal(this);
36
46
  this._metadataChanged = new Signal(this);
47
+ this._initialSyncResolved = false;
37
48
  this._options = this.ydoc.getMap('options');
38
49
  this._layers = this.ydoc.getMap('layers');
39
50
  this._layerTree = this.ydoc.getArray('layerTree');
@@ -44,6 +55,9 @@ export class JupyterGISDoc extends YDocument {
44
55
  this.undoManager.addToScope(this._sources);
45
56
  this.undoManager.addToScope(this._stories);
46
57
  this.undoManager.addToScope(this._layerTree);
58
+ this._initialSyncReadyPromise = new Promise(resolve => {
59
+ this._initialSyncReadyResolve = resolve;
60
+ });
47
61
  this._layers.observeDeep(this._layersObserver.bind(this));
48
62
  this._layerTree.observe(this._layerTreeObserver.bind(this));
49
63
  this._sources.observeDeep(this._sourcesObserver.bind(this));
@@ -51,6 +65,16 @@ export class JupyterGISDoc extends YDocument {
51
65
  this._options.observe(this._optionsObserver.bind(this));
52
66
  this._metadata.observe(this._metaObserver.bind(this));
53
67
  }
68
+ get initialSyncReady() {
69
+ return this._initialSyncReadyPromise;
70
+ }
71
+ _onOptionsObserverFired() {
72
+ if (this._initialSyncResolved) {
73
+ return;
74
+ }
75
+ this._initialSyncResolved = true;
76
+ this._initialSyncReadyResolve();
77
+ }
54
78
  getSource() {
55
79
  const layers = this._layers.toJSON();
56
80
  const layerTree = this._layerTree.toJSON();
@@ -128,6 +128,7 @@ export interface IJupyterGISDoc extends YDocument<IJupyterGISDocChange> {
128
128
  storyMapsChanged: ISignal<IJupyterGISDoc, IJGISStoryMapDocChange>;
129
129
  layerTreeChanged: ISignal<IJupyterGISDoc, IJGISLayerTreeDocChange>;
130
130
  metadataChanged: ISignal<IJupyterGISDoc, MapChange>;
131
+ initialSyncReady: Promise<void>;
131
132
  }
132
133
  export interface IJupyterGISDocChange extends DocumentChange {
133
134
  contextChange?: MapChange;
@@ -1,6 +1,6 @@
1
- export * from '../../_interface/processing/buffer';
1
+ export * from '../../_interface/processing/centroids';
2
2
  export * from '../../_interface/processing/convexHull';
3
- export * from '../../_interface/processing/dissolve';
4
3
  export * from '../../_interface/processing/concaveHull';
4
+ export * from '../../_interface/processing/buffer';
5
+ export * from '../../_interface/processing/dissolve';
5
6
  export * from '../../_interface/processing/boundingBoxes';
6
- export * from '../../_interface/processing/centroids';
@@ -1,7 +1,7 @@
1
1
  //Generated automatically please don't modify directly
2
- export * from '../../_interface/processing/buffer';
2
+ export * from '../../_interface/processing/centroids';
3
3
  export * from '../../_interface/processing/convexHull';
4
- export * from '../../_interface/processing/dissolve';
5
4
  export * from '../../_interface/processing/concaveHull';
5
+ export * from '../../_interface/processing/buffer';
6
+ export * from '../../_interface/processing/dissolve';
6
7
  export * from '../../_interface/processing/boundingBoxes';
7
- export * from '../../_interface/processing/centroids';
@@ -1,2 +1,2 @@
1
- export type ProcessingType = 'Buffer' | 'ConvexHull' | 'Dissolve' | 'ConcaveHull' | 'BoundingBoxes' | 'Centroids';
1
+ export type ProcessingType = 'Centroids' | 'ConvexHull' | 'ConcaveHull' | 'Buffer' | 'Dissolve' | 'BoundingBoxes';
2
2
  export declare const processingList: string[];
@@ -1,8 +1,8 @@
1
1
  export const processingList = [
2
- 'Buffer',
2
+ 'Centroids',
3
3
  'ConvexHull',
4
- 'Dissolve',
5
4
  'ConcaveHull',
5
+ 'Buffer',
6
+ 'Dissolve',
6
7
  'BoundingBoxes',
7
- 'Centroids',
8
8
  ];
@@ -1,14 +1,12 @@
1
1
  [
2
2
  {
3
- "description": "Buffer",
4
- "name": "buffer",
5
- "label": "Buffer",
6
- "operationParams": [
7
- "bufferDistance"
8
- ],
3
+ "description": "Centroids",
4
+ "name": "centroids",
5
+ "operationParams": [],
6
+ "label": "Centroids",
9
7
  "operations": {
10
8
  "gdalFunction": "ogr2ogr",
11
- "sql": "SELECT ST_Union(ST_Buffer(geometry, {bufferDistance})) AS geometry, * FROM \"{layerName}\""
9
+ "sql": "SELECT ST_Centroid(geometry) AS geometry, * FROM \"{layerName}\""
12
10
  },
13
11
  "type": "vector"
14
12
  },
@@ -24,29 +22,42 @@
24
22
  "type": "vector"
25
23
  },
26
24
  {
27
- "description": "Dissolve",
28
- "name": "dissolve",
25
+ "description": "ConcaveHull",
26
+ "name": "concaveHull",
29
27
  "operationParams": [
30
- "dissolveField"
28
+ "pctconvex",
29
+ "allowHoles"
30
+ ],
31
+ "label": "Concave Hull",
32
+ "operations": {
33
+ "sql": "SELECT ST_ConcaveHull(geometry,{pctconvex},{allowHoles}) AS geometry, * FROM \"{layerName}\"",
34
+ "gdalFunction": "ogr2ogr"
35
+ },
36
+ "type": "vector"
37
+ },
38
+ {
39
+ "description": "Buffer",
40
+ "name": "buffer",
41
+ "label": "Buffer",
42
+ "operationParams": [
43
+ "bufferDistance"
31
44
  ],
32
- "label": "Dissolve",
33
45
  "operations": {
34
46
  "gdalFunction": "ogr2ogr",
35
- "sql": "SELECT ST_Union(geometry) AS geometry, {dissolveField} FROM \"{layerName}\" GROUP BY {dissolveField}"
47
+ "sql": "SELECT ST_Union(ST_Buffer(geometry, {bufferDistance})) AS geometry, * FROM \"{layerName}\""
36
48
  },
37
49
  "type": "vector"
38
50
  },
39
51
  {
40
- "description": "ConcaveHull",
41
- "name": "concaveHull",
52
+ "description": "Dissolve",
53
+ "name": "dissolve",
42
54
  "operationParams": [
43
- "pctconvex",
44
- "allowHoles"
55
+ "dissolveField"
45
56
  ],
46
- "label": "Concave Hull",
57
+ "label": "Dissolve",
47
58
  "operations": {
48
- "sql": "SELECT ST_ConcaveHull(geometry,{pctconvex},{allowHoles}) AS geometry, * FROM \"{layerName}\"",
49
- "gdalFunction": "ogr2ogr"
59
+ "gdalFunction": "ogr2ogr",
60
+ "sql": "SELECT ST_Union(geometry) AS geometry, {dissolveField} FROM \"{layerName}\" GROUP BY {dissolveField}"
50
61
  },
51
62
  "type": "vector"
52
63
  },
@@ -60,16 +71,5 @@
60
71
  "gdalFunction": "ogr2ogr"
61
72
  },
62
73
  "type": "vector"
63
- },
64
- {
65
- "description": "Centroids",
66
- "name": "centroids",
67
- "operationParams": [],
68
- "label": "Centroids",
69
- "operations": {
70
- "gdalFunction": "ogr2ogr",
71
- "sql": "SELECT ST_Centroid(geometry) AS geometry, * FROM \"{layerName}\""
72
- },
73
- "type": "vector"
74
74
  }
75
75
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupytergis/schema",
3
- "version": "0.13.2",
3
+ "version": "0.13.3",
4
4
  "description": "A JupyterGIS schema package.",
5
5
  "keywords": [
6
6
  "jupytergis"