@@ -43,8 +43,7 @@ class GISDocument(CommWidget):
43
43
"""
44
44
Create a new GISDocument object.
45
45
46
- :param path: the path to the file that you would like to open.
47
- If not provided, a new empty document will be created.
46
+ :param path: the path to the file that you would like to open. If not provided, a new empty document will be created.
48
47
"""
49
48
50
49
def __init__ (
@@ -234,7 +233,7 @@ def add_geojson_layer(
234
233
logical_op : str | None = None ,
235
234
feature : str | None = None ,
236
235
operator : str | None = None ,
237
- value : Union [str , number , float ] | None = None ,
236
+ value : Union [str , int , float ] | None = None ,
238
237
color_expr = None ,
239
238
):
240
239
"""
@@ -244,7 +243,6 @@ def add_geojson_layer(
244
243
:param path: The path to the JSON file to embed into the jGIS file.
245
244
:param data: The raw GeoJSON data to embed into the jGIS file.
246
245
:param type: The type of the vector layer to create.
247
- :param color: The color to apply to features.
248
246
:param opacity: The opacity, between 0 and 1.
249
247
:param color_expr: The style expression used to style the layer, defaults to None
250
248
"""
@@ -334,9 +332,9 @@ def add_image_layer(
334
332
335
333
def add_video_layer (
336
334
self ,
337
- urls : [] ,
335
+ urls : List ,
338
336
name : str = "Image Layer" ,
339
- coordinates : [ ] = [] ,
337
+ coordinates : Optional [ List ] = None ,
340
338
opacity : float = 1 ,
341
339
):
342
340
"""
@@ -347,6 +345,8 @@ def add_video_layer(
347
345
:param coordinates: Corners of video specified in longitude, latitude pairs.
348
346
:param opacity: The opacity, between 0 and 1.
349
347
"""
348
+ if coordinates is None :
349
+ coordinates = []
350
350
351
351
if urls is None or coordinates is None :
352
352
raise ValueError ("URLs and Coordinates are required" )
@@ -383,14 +383,14 @@ def add_tiff_layer(
383
383
"""
384
384
Add a tiff layer
385
385
386
- :param str url: URL of the tif
387
- :param int min: Minimum pixel value to be displayed, defaults to letting the map display set the value
388
- :param int max: Maximum pixel value to be displayed, defaults to letting the map display set the value
389
- :param str name: The name that will be used for the object in the document, defaults to "Tiff Layer"
390
- :param bool normalize: Select whether to normalize values between 0..1, if false than min/max have no effect, defaults to True
391
- :param bool wrapX: Render tiles beyond the tile grid extent, defaults to False
392
- :param float opacity: The opacity, between 0 and 1, defaults to 1.0
393
- :param _type_ color_expr: The style expression used to style the layer, defaults to None
386
+ :param url: URL of the tif
387
+ :param min: Minimum pixel value to be displayed, defaults to letting the map display set the value
388
+ :param max: Maximum pixel value to be displayed, defaults to letting the map display set the value
389
+ :param name: The name that will be used for the object in the document, defaults to "Tiff Layer"
390
+ :param normalize: Select whether to normalize values between 0..1, if false than min/max have no effect, defaults to True
391
+ :param wrapX: Render tiles beyond the tile grid extent, defaults to False
392
+ :param opacity: The opacity, between 0 and 1, defaults to 1.0
393
+ :param color_expr: The style expression used to style the layer, defaults to None
394
394
"""
395
395
396
396
source = {
@@ -421,7 +421,7 @@ def add_hillshade_layer(
421
421
self ,
422
422
url : str ,
423
423
name : str = "Hillshade Layer" ,
424
- urlParameters : Dict = {} ,
424
+ urlParameters : Optional [ Dict ] = None ,
425
425
attribution : str = "" ,
426
426
):
427
427
"""
@@ -431,6 +431,8 @@ def add_hillshade_layer(
431
431
:param str name: The name that will be used for the object in the document, defaults to "Hillshade Layer"
432
432
:param attribution: The attribution.
433
433
"""
434
+ if urlParameters is None :
435
+ urlParameters = {}
434
436
435
437
source = {
436
438
"type" : SourceType .RasterDemSource ,
@@ -454,14 +456,14 @@ def add_hillshade_layer(
454
456
455
457
def add_heatmap_layer (
456
458
self ,
457
- feature : string ,
459
+ feature : str ,
458
460
path : str | Path | None = None ,
459
461
data : Dict | None = None ,
460
462
name : str = "Heatmap Layer" ,
461
463
opacity : float = 1 ,
462
- blur : number = 15 ,
463
- radius : number = 8 ,
464
- gradient : List [str ] = [ "#00f" , "#0ff" , "#0f0" , "#ff0" , "#f00" ] ,
464
+ blur : int = 15 ,
465
+ radius : int = 8 ,
466
+ gradient : Optional [ List [str ]] = None ,
465
467
):
466
468
"""
467
469
Add a Heatmap Layer to the document.
@@ -495,6 +497,9 @@ def add_heatmap_layer(
495
497
if data is not None :
496
498
parameters = {"data" : data }
497
499
500
+ if gradient is None :
501
+ gradient = ["#00f" , "#0ff" , "#0f0" , "#ff0" , "#f00" ]
502
+
498
503
source = {
499
504
"type" : SourceType .GeoJSONSource ,
500
505
"name" : f"{ name } Source" ,
@@ -609,16 +614,16 @@ def add_filter(
609
614
logical_op : str ,
610
615
feature : str ,
611
616
operator : str ,
612
- value : Union [str , number , float ],
617
+ value : Union [str , int , float ],
613
618
):
614
619
"""
615
620
Add a filter to a layer
616
621
617
- :param str layer_id: The ID of the layer to filter
618
- :param str logical_op: The logical combination to apply to filters. Must be "any" or "all"
619
- :param str feature: The feature to be filtered on
620
- :param str operator: The operator used to compare the feature and value
621
- :param Union[str, number, float] value: The value to be filtered on
622
+ :param layer_id: The ID of the layer to filter
623
+ :param logical_op: The logical combination to apply to filters. Must be "any" or "all"
624
+ :param feature: The feature to be filtered on
625
+ :param operator: The operator used to compare the feature and value
626
+ :param value: The value to be filtered on
622
627
"""
623
628
layer = self ._layers .get (layer_id )
624
629
@@ -655,16 +660,16 @@ def update_filter(
655
660
logical_op : str ,
656
661
feature : str ,
657
662
operator : str ,
658
- value : Union [str , number , float ],
663
+ value : Union [str , int , float ],
659
664
):
660
665
"""
661
666
Update a filter applied to a layer
662
667
663
- :param str layer_id: The ID of the layer to filter
664
- :param str logical_op: The logical combination to apply to filters. Must be "any" or "all"
665
- :param str feature: The feature to update the value for
666
- :param str operator: The operator used to compare the feature and value
667
- :param Union[str, number, float] value: The new value to be filtered on
668
+ :param layer_id: The ID of the layer to filter
669
+ :param logical_op: The logical combination to apply to filters. Must be "any" or "all"
670
+ :param feature: The feature to update the value for
671
+ :param operator: The operator used to compare the feature and value
672
+ :param value: The new value to be filtered on
668
673
"""
669
674
layer = self ._layers .get (layer_id )
670
675
0 commit comments