@@ -43,8 +43,7 @@ class GISDocument(CommWidget):
4343 """
4444 Create a new GISDocument object.
4545
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.
4847 """
4948
5049 def __init__ (
@@ -234,7 +233,7 @@ def add_geojson_layer(
234233 logical_op : str | None = None ,
235234 feature : str | None = None ,
236235 operator : str | None = None ,
237- value : Union [str , number , float ] | None = None ,
236+ value : Union [str , int , float ] | None = None ,
238237 color_expr = None ,
239238 ):
240239 """
@@ -244,7 +243,6 @@ def add_geojson_layer(
244243 :param path: The path to the JSON file to embed into the jGIS file.
245244 :param data: The raw GeoJSON data to embed into the jGIS file.
246245 :param type: The type of the vector layer to create.
247- :param color: The color to apply to features.
248246 :param opacity: The opacity, between 0 and 1.
249247 :param color_expr: The style expression used to style the layer, defaults to None
250248 """
@@ -334,9 +332,9 @@ def add_image_layer(
334332
335333 def add_video_layer (
336334 self ,
337- urls : [] ,
335+ urls : List ,
338336 name : str = "Image Layer" ,
339- coordinates : [ ] = [] ,
337+ coordinates : Optional [ List ] = None ,
340338 opacity : float = 1 ,
341339 ):
342340 """
@@ -347,6 +345,8 @@ def add_video_layer(
347345 :param coordinates: Corners of video specified in longitude, latitude pairs.
348346 :param opacity: The opacity, between 0 and 1.
349347 """
348+ if coordinates is None :
349+ coordinates = []
350350
351351 if urls is None or coordinates is None :
352352 raise ValueError ("URLs and Coordinates are required" )
@@ -383,14 +383,14 @@ def add_tiff_layer(
383383 """
384384 Add a tiff layer
385385
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
394394 """
395395
396396 source = {
@@ -421,7 +421,7 @@ def add_hillshade_layer(
421421 self ,
422422 url : str ,
423423 name : str = "Hillshade Layer" ,
424- urlParameters : Dict = {} ,
424+ urlParameters : Optional [ Dict ] = None ,
425425 attribution : str = "" ,
426426 ):
427427 """
@@ -431,6 +431,8 @@ def add_hillshade_layer(
431431 :param str name: The name that will be used for the object in the document, defaults to "Hillshade Layer"
432432 :param attribution: The attribution.
433433 """
434+ if urlParameters is None :
435+ urlParameters = {}
434436
435437 source = {
436438 "type" : SourceType .RasterDemSource ,
@@ -454,14 +456,14 @@ def add_hillshade_layer(
454456
455457 def add_heatmap_layer (
456458 self ,
457- feature : string ,
459+ feature : str ,
458460 path : str | Path | None = None ,
459461 data : Dict | None = None ,
460462 name : str = "Heatmap Layer" ,
461463 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 ,
465467 ):
466468 """
467469 Add a Heatmap Layer to the document.
@@ -495,6 +497,9 @@ def add_heatmap_layer(
495497 if data is not None :
496498 parameters = {"data" : data }
497499
500+ if gradient is None :
501+ gradient = ["#00f" , "#0ff" , "#0f0" , "#ff0" , "#f00" ]
502+
498503 source = {
499504 "type" : SourceType .GeoJSONSource ,
500505 "name" : f"{ name } Source" ,
@@ -609,16 +614,16 @@ def add_filter(
609614 logical_op : str ,
610615 feature : str ,
611616 operator : str ,
612- value : Union [str , number , float ],
617+ value : Union [str , int , float ],
613618 ):
614619 """
615620 Add a filter to a layer
616621
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
622627 """
623628 layer = self ._layers .get (layer_id )
624629
@@ -655,16 +660,16 @@ def update_filter(
655660 logical_op : str ,
656661 feature : str ,
657662 operator : str ,
658- value : Union [str , number , float ],
663+ value : Union [str , int , float ],
659664 ):
660665 """
661666 Update a filter applied to a layer
662667
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
668673 """
669674 layer = self ._layers .get (layer_id )
670675
0 commit comments