[SCM] PostGIS branch stable-3.5 updated. 3.5.7-74-ge0adbb804

git at osgeo.org git at osgeo.org
Sun Jul 19 23:40:35 PDT 2026


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, stable-3.5 has been updated
       via  e0adbb804e561767223482fec5c70d1315fa7de1 (commit)
       via  54bcbe637e38366a06861beffcbf775b295d4469 (commit)
      from  6b351402efd21a4cd1d3a9bb4da4caf51fe1f513 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit e0adbb804e561767223482fec5c70d1315fa7de1
Merge: 6b351402e 54bcbe637
Author: Darafei Praliaskouski <komzpa at gmail.com>
Date:   Sun Jul 19 23:40:34 2026 -0700

    Merge pull request 'doc: avoid overlong GraphicsMagick draw options on stable 3.5' (!462) from Komzpa/postgis:fix/stable-3.5-doc-generator-gm-drawfile into stable-3.5
    
    Reviewed-on: https://gitea.osgeo.org/postgis/postgis/pulls/462


commit 54bcbe637e38366a06861beffcbf775b295d4469
Author: Darafei Praliaskouski <me at komzpa.net>
Date:   Mon Jul 20 08:33:21 2026 +0400

    doc: avoid overlong GraphicsMagick draw options

diff --git a/doc/html/images/generator.c b/doc/html/images/generator.c
index 0ada4e581..8a3f6a773 100644
--- a/doc/html/images/generator.c
+++ b/doc/html/images/generator.c
@@ -98,6 +98,8 @@ typedef struct generator_job {
 	const char *converter_cli;
 	LAYERSTYLE *styles;
 	stringbuffer_t command;
+	const char *tmpdir;
+	unsigned int draw_num;
 } generator_job;
 
 static void
@@ -107,6 +109,8 @@ generator_job_init(generator_job *job, const generator_options *options)
 	job->converter_cli = NULL;
 	job->styles = NULL;
 	stringbuffer_init(&job->command);
+	job->tmpdir = NULL;
+	job->draw_num = 0;
 }
 
 static void
@@ -123,6 +127,8 @@ generator_job_reset(generator_job *job)
 
 typedef struct draw_context_t {
 	LAYERSTYLE *style;
+	const char *tmpdir;
+	unsigned int *draw_num;
 } GEOMETRY_DRAW_CONTEXT;
 
 static GEOMETRY_DRAW_CONTEXT
@@ -130,6 +136,8 @@ geometry_draw_context_init(void)
 {
 	GEOMETRY_DRAW_CONTEXT ctx;
 	ctx.style = NULL;
+	ctx.tmpdir = NULL;
+	ctx.draw_num = NULL;
 	return ctx;
 }
 
@@ -160,6 +168,20 @@ checked_system(const char *cmd)
 	}
 }
 
+static void
+cleanup_temp_dir(const char *dir)
+{
+	stringbuffer_t command;
+
+	if (!dir)
+		return;
+
+	stringbuffer_init(&command);
+	stringbuffer_aprintf(&command, "rm -rf %s", dir);
+	checked_system(stringbuffer_getstring(&command));
+	stringbuffer_release(&command);
+}
+
 /*
  * Locate executables in PATH using liblwgeom's stringbuffer helpers so the
  * probing logic can be promoted to the raster tooling if it ever needs the
@@ -354,6 +376,39 @@ pointarrayToBuffer(stringbuffer_t *output, POINTARRAY *pa)
 	}
 }
 
+static int
+append_draw_file(stringbuffer_t *output, GEOMETRY_DRAW_CONTEXT *ctx, const char *draw_command)
+{
+	stringbuffer_t draw_path;
+	FILE *draw_file;
+
+	if (!ctx->tmpdir || !ctx->draw_num)
+	{
+		lwerror("Temporary draw-file context is not initialized");
+		return -1;
+	}
+
+	stringbuffer_init(&draw_path);
+	stringbuffer_aprintf(&draw_path, "%s/draw%u", ctx->tmpdir, (*ctx->draw_num)++);
+
+	draw_file = fopen(stringbuffer_getstring(&draw_path), "w");
+	if (!draw_file)
+	{
+		perror(stringbuffer_getstring(&draw_path));
+		stringbuffer_release(&draw_path);
+		return -1;
+	}
+
+	fputs(draw_command, draw_file);
+	fclose(draw_file);
+
+	stringbuffer_append(output, "-draw '@");
+	stringbuffer_append(output, stringbuffer_getstring(&draw_path));
+	stringbuffer_append(output, "' ");
+	stringbuffer_release(&draw_path);
+	return 0;
+}
+
 /**
  * Draws a point in a POINTARRAY to a char* using GraphicsMagick SVG for styling.
 
@@ -483,9 +538,11 @@ drawLineString(stringbuffer_t *output, LWLINE *lwl, GEOMETRY_DRAW_CONTEXT *ctx)
 	pointarrayToBuffer(&path, lwl->points);
 	stringbuffer_append(&path, "'");
 
-	stringbuffer_append(output, "-draw \"");
-	stringbuffer_append(output, stringbuffer_getstring(&path));
-	stringbuffer_append(output, "\" ");
+	if (append_draw_file(output, ctx, stringbuffer_getstring(&path)) < 0)
+	{
+		stringbuffer_release(&path);
+		return;
+	}
 
 	stringbuffer_release(&path);
 
@@ -530,9 +587,11 @@ drawPolygon(stringbuffer_t *output, LWPOLY *lwp, GEOMETRY_DRAW_CONTEXT *ctx)
 	}
 	stringbuffer_append(&path, "'");
 
-	stringbuffer_append(output, "-draw \"");
-	stringbuffer_append(output, stringbuffer_getstring(&path));
-	stringbuffer_append(output, "\" ");
+	if (append_draw_file(output, ctx, stringbuffer_getstring(&path)) < 0)
+	{
+		stringbuffer_release(&path);
+		return;
+	}
 
 	stringbuffer_release(&path);
 }
@@ -666,6 +725,8 @@ append_layers(generator_job *job, FILE *source)
 		LWDEBUGF(4, "geom = %s", lwgeom_to_ewkt(lwgeom));
 
 		ctx.style = getStyle(job->styles, style_name);
+		ctx.tmpdir = job->tmpdir;
+		ctx.draw_num = &job->draw_num;
 		if (!ctx.style)
 		{
 			lwgeom_free(lwgeom);
@@ -740,6 +801,7 @@ generator_render(const generator_options *options, const char *source_path, cons
 	char *target_path = NULL;
 	int rc = -1;
 	const char *converter_cli;
+	char tempdir_template[] = "generator-temp-XXXXXX";
 
 	generator_job_init(&job, options);
 
@@ -751,6 +813,12 @@ generator_render(const generator_options *options, const char *source_path, cons
 		goto cleanup;
 	}
 	job.converter_cli = converter_cli;
+	job.tmpdir = mkdtemp(tempdir_template);
+	if (!job.tmpdir)
+	{
+		perror("generator-temp");
+		goto cleanup;
+	}
 
 	source = fopen(source_path, "r");
 	if (!source)
@@ -800,6 +868,7 @@ cleanup:
 		lwfree(styles_path);
 	if (target_path)
 		lwfree(target_path);
+	cleanup_temp_dir(job.tmpdir);
 	generator_job_reset(&job);
 	return rc;
 }

-----------------------------------------------------------------------

Summary of changes:
 doc/html/images/generator.c | 81 +++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 75 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list