Opened 16 years ago

Last modified 16 years ago

#2526 closed defect

(some) ImageMaps are Empty — at Version 2

Reported by: BobBruce Owned by: dmorissette
Priority: normal Milestone: 5.0.3 release
Component: MapServer C Library Version: 4.10
Severity: normal Keywords: imagemap
Cc:

Description (last modified by dmorissette)

I am trying to generate imagemaps of point symbols on my map and am finding that as soon as my map has large amount of point symbols on it the imagemap becomes empty except for the beginning and closing map statements. The imagemap for maps with a small amount of symbols are generated perfectly well.

I reported this to the mapserver-dev list under the subject "Is there a size limit on ImageMaps, and if so can I increase it?" on February 24, 2008 and Daniel Morisette responded with a fix for MapServer 5. Here is his fix:

--- mapimagemap.c       (revision 7396)
+++ mapimagemap.c       (working copy)
@@ -2029,7 +2029,7 @@
                {
                    snprintf(workbuffer, sizeof(workbuffer), "%s", 
img->img.imagemap+iIndice );
                    workbuffer[nSize-1] = '\0';
-                  msIO_fprintf(stream, workbuffer);
+                  msIO_fwrite(workbuffer, strlen(workbuffer), 1, stream);
                    iIndice +=nSize-1;
                }
                if (iIndice < size)
@@ -2039,7 +2039,7 @@
                }
            }
            else
-            msIO_fprintf(stream, img->img.imagemap);
+              msIO_fwrite(img->img.imagemap, size, 1, stream);
           if( strcasecmp("OFF",msGetOutputFormatOption( format, 
"SKIPENDTAG", "OFF" )) == 0){
                   if (dxf == 2)
                           msIO_fprintf(stream, "END");

Since I was working with MapServer 4.10.2 I had to figure out how to implement it for that version, here are my comments as per the posting to the list:

I located the old code in function msSaveImageIM and it now reads like this:

	  } else {
	    msIO_fprintf(stream, "<map name=\"%s\" width=\"%d\" height=\"%d\">\n", mapName, img->width, img->height);
    	  }
/* BB - 25 Feb 2009 - next 2 lines */
	  /* msIO_fprintf(stream, img->img.imagemap); */
      msIO_fwrite(img->img.imagemap, strlen(img->img.imagemap), 1, stream);
	  if( strcasecmp("OFF",msGetOutputFormatOption( format, "SKIPENDTAG", "OFF" )) == 0){
		  if (dxf == 2)
			  msIO_fprintf(stream, "END");
		  else if (dxf)
			  msIO_fprintf(stream, "0\nENDSEC\n0\nEOF\n");
		  else 
/* BB - 25 Feb 2009 - next 2 lines */
			  /* msIO_fprintf(stream, "</map>"); */
              msIO_fwrite("</map>", 6, 1, stream);

and now the imagemap is fixed on my website. I have attached my new version of mapimagemap.c

Bob Bruce

Change History (3)

by BobBruce, 16 years ago

Attachment: mapimagemap.c added

Repaired version of mapimagemap.c file

comment:1 by dmorissette, 16 years ago

Description: modified (diff)
Milestone: 5.0.3 release
Status: newassigned

comment:2 by dmorissette, 16 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.