From a63ed139ec5155a868c1907753a306bf5a6e9970 Mon Sep 17 00:00:00 2001 From: elliot-100 <3186037+elliot-100@users.noreply.github.com> Date: Tue, 11 Mar 2025 11:03:20 +0000 Subject: [PATCH 1/2] Docs: Fix #2905 `utilities.image_to_url()` image parameter documentation issues --- folium/features.py | 14 +++++++------- folium/raster_layers.py | 12 +++++++----- folium/utilities.py | 15 +++++++++------ 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/folium/features.py b/folium/features.py index dc9349ef01..0174ac0180 100644 --- a/folium/features.py +++ b/folium/features.py @@ -1862,13 +1862,13 @@ class CustomIcon(Icon): Parameters ---------- - icon_image : string, file or array-like object - The data you want to use as an icon. - * If string, it will be written directly in the output file. - * If file, it's content will be converted as embedded in the - output file. - * If array-like, it will be converted to PNG base64 string - and embedded in the output. + icon_image : string or array-like object + The data to use as an icon. + * If string is a path to an image file, its content will be converted and + embedded. + * If string is a URL, it will be linked. + * Otherwise a string will be assumed to be JSON and embedded. + * If array-like, it will be converted to PNG base64 string and embedded. icon_size : tuple of 2 int, optional Size of the icon image in pixels. diff --git a/folium/raster_layers.py b/folium/raster_layers.py index 0ff6ef9948..4fe507b672 100644 --- a/folium/raster_layers.py +++ b/folium/raster_layers.py @@ -243,11 +243,13 @@ class ImageOverlay(Layer): Parameters ---------- - image: string, file or array-like object - The data you want to draw on the map. - * If string, it will be written directly in the output file. - * If file, it's content will be converted as embedded in the output file. - * If array-like, it will be converted to PNG base64 string and embedded in the output. + image: string or array-like object + The data to overlay as an image. + * If string is a path to an image file, its content will be converted and + embedded. + * If string is a URL, it will be linked. + * Otherwise a string will be assumed to be JSON and embedded. + * If array-like, it will be converted to PNG base64 string and embedded. bounds: list/tuple of list/tuple of float Image bounds on the map in the form [[lat_min, lon_min], [lat_max, lon_max]] diff --git a/folium/utilities.py b/folium/utilities.py index 9210bf59e6..c462299756 100644 --- a/folium/utilities.py +++ b/folium/utilities.py @@ -169,12 +169,15 @@ def image_to_url( Parameters ---------- - image: string, file or array-like object - * If string, it will be written directly in the output file. - * If file, it's content will be converted as embedded in the - output file. - * If array-like, it will be converted to PNG base64 string and - embedded in the output. + image: string or array-like object + * If string is a path to an image file, its content will be converted and + embedded in the output URL. + * If string is a URL, it will be linked in the output URL. + * Otherwise a string will be assumed to be JSON and embedded in the + output URL. + * If array-like, it will be converted to PNG base64 string and embedded in the + output URL. + origin: ['upper' | 'lower'], optional, default 'upper' Place the [0, 0] index of the array in the upper left or lower left corner of the axes. From 4bbb3956349154532606197acf9816de13da600f Mon Sep 17 00:00:00 2001 From: Frank <33519926+Conengmo@users.noreply.github.com> Date: Sat, 15 Mar 2025 14:37:56 +0100 Subject: [PATCH 2/2] improve docs output --- folium/features.py | 10 +++++----- folium/raster_layers.py | 13 +++++++------ folium/utilities.py | 15 +++++++-------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/folium/features.py b/folium/features.py index 0174ac0180..1c18f426db 100644 --- a/folium/features.py +++ b/folium/features.py @@ -1864,12 +1864,12 @@ class CustomIcon(Icon): ---------- icon_image : string or array-like object The data to use as an icon. - * If string is a path to an image file, its content will be converted and - embedded. - * If string is a URL, it will be linked. - * Otherwise a string will be assumed to be JSON and embedded. - * If array-like, it will be converted to PNG base64 string and embedded. + * If string is a path to an image file, its content will be converted and + embedded. + * If string is a URL, it will be linked. + * Otherwise a string will be assumed to be JSON and embedded. + * If array-like, it will be converted to PNG base64 string and embedded. icon_size : tuple of 2 int, optional Size of the icon image in pixels. icon_anchor : tuple of 2 int, optional diff --git a/folium/raster_layers.py b/folium/raster_layers.py index 4fe507b672..5e846e9bd2 100644 --- a/folium/raster_layers.py +++ b/folium/raster_layers.py @@ -245,14 +245,15 @@ class ImageOverlay(Layer): ---------- image: string or array-like object The data to overlay as an image. - * If string is a path to an image file, its content will be converted and - embedded. - * If string is a URL, it will be linked. - * Otherwise a string will be assumed to be JSON and embedded. - * If array-like, it will be converted to PNG base64 string and embedded. + + * If string is a path to an image file, its content will be converted and + embedded. + * If string is a URL, it will be linked. + * Otherwise a string will be assumed to be JSON and embedded. + * If array-like, it will be converted to PNG base64 string and embedded. bounds: list/tuple of list/tuple of float Image bounds on the map in the form - [[lat_min, lon_min], [lat_max, lon_max]] + [[lat_min, lon_min], [lat_max, lon_max]] opacity: float, default Leaflet's default (1.0) alt: string, default Leaflet's default ('') origin: ['upper' | 'lower'], optional, default 'upper' diff --git a/folium/utilities.py b/folium/utilities.py index c462299756..09fd20c5de 100644 --- a/folium/utilities.py +++ b/folium/utilities.py @@ -170,14 +170,13 @@ def image_to_url( Parameters ---------- image: string or array-like object - * If string is a path to an image file, its content will be converted and - embedded in the output URL. - * If string is a URL, it will be linked in the output URL. - * Otherwise a string will be assumed to be JSON and embedded in the - output URL. - * If array-like, it will be converted to PNG base64 string and embedded in the - output URL. - + * If string is a path to an image file, its content will be converted and + embedded in the output URL. + * If string is a URL, it will be linked in the output URL. + * Otherwise a string will be assumed to be JSON and embedded in the + output URL. + * If array-like, it will be converted to PNG base64 string and embedded in the + output URL. origin: ['upper' | 'lower'], optional, default 'upper' Place the [0, 0] index of the array in the upper left or lower left corner of the axes.