[mapserver-dev] Is there a size limit on ImageMaps, and if so can I increase it?

Bob Bruce Bob.Bruce at pobox.com
Tue Feb 26 00:16:00 EST 2008


Thanks a million Daniel, problem solved!!!

I decided to stick with version 4.10.2 for the time being because I had
already built everything with it. Hopefully sometime soon I will transition
to MapServer 5. Anyway 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);

so now I can draw large areas with many mural symbols and the imagemap is
produced and the website works.

I have made changes to map.h , mapdraw.c , mapimagemap.c , mapraster.c and
mapscript_i.c to allow the indices of point symbols to be passed to the
imagemap creation software so that a map like the ones produced by this
website could be done with MapScript. If someone ever wanted to implement
these changes they are available. I did put them up on Trac in the middle of
2005 but they were never implemented.

I have attached my new version of mapimagemap.c for version 4.10.2 of
MapServer.

I will report this problem on Trac.

If you're ever in Winnipeg, please look me up, I would be happy to buy you
some beers.

   Bob Bruce

-----Original Message-----
From: Daniel Morissette [mailto:dmorissette at mapgears.com]
Sent: 25-Feb-08 12:29 PM
To: Bob.Bruce at pobox.com
Cc: mapserver-dev at lists.osgeo.org
Subject: Re: [mapserver-dev] Is there a size limit on ImageMaps,and if
so can I increase it?


Correction... use this patch instead:

--- 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");


Daniel Morissette wrote:
> Bob Bruce wrote:
>> Daniel:
>>               I am using version 4.10.2 . Previously I had this
>> working in a version of MapServer in 2005 and it is still working to
>> this day at www.themuralsofwinnipeg.com/Mpages/indexMuralsMap.php with
>> this old version (if you select the South-Portage neighbourhood it
>> works fine). Now I wanted to upgrade to version 4 but wasn't ready to
>> take the leap to version 5. Do you think that I need to upgrade to
>> version 5 and rebuild MapServer etc.?
>>
>
> I don't know for sure, but chances are that the problem could have the
> same root as the legend problem, that is: msIO_fprintf() returns
> silently, without any error, if the output is too large. Based on a
> quick look at mapimagemap.c that's probably not fixed in v5.0 for
> imagemaps. It seems that the following patch (replacing msIO_fprintf()
> with msIO_fwrite() as we did in ticket 1946 for legends) might solve the
> problem for imagemaps:
>
>
> --- 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, nSize, 1, stream);
>                    iIndice +=nSize-1;
>                }
>                if (iIndice < size)
>
>
> If that works then please file a ticket in Trac and assign to me (Trac
> id dmorissette) so that we include this fix in the next release.
>
> Daniel


--
Daniel Morissette
http://www.mapgears.com/
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.516 / Virus Database: 269.21.1/1297 - Release Date: 25/02/2008
9:22 AM

No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.516 / Virus Database: 269.21.1/1297 - Release Date: 25/02/2008
9:22 AM




More information about the mapserver-dev mailing list