Ticket #2115 (closed defect: fixed)

Opened 6 years ago

Last modified 2 years ago

AGG palette formatoption requires absolute path

Reported by: jmckenna Owned by: sdlime
Priority: normal Milestone: 6.0 release
Component: MapServer C Library Version: 5.0
Severity: normal Keywords:
Cc: assefa, zjames, warmerdam, tbonfort, aboudreault

Description (last modified by warmerdam) (diff)

Relative paths to the AGG palette file do not work:

OUTPUTFORMAT
    NAME "agg/png24"
    MIMETYPE "image/png; mode=24bit"
    DRIVER "AGG/PNG"
    EXTENSION "png"
    IMAGEMODE "RGB"
    FORMATOPTION "PALETTE_FORCE=TRUE"
    FORMATOPTION "PALETTE=palette.txt"  
END 

causes this error: msImageCreateWithPaletteGD(): Unable to access file. Error opening palette file palette.txt

It should be relative to the location of the mapfile.

Change History

Changed 6 years ago by sdlime

  • component changed from AGG to MapServer C Library

I agree and would have set it up that way if it were straightforward. Problem is that the image handling is basically mapfile independent and I don't have access to the stored path from an image format object. Not sure how best to handle...

Also changing component since this isn't specific to AGG.

Steve

Changed 6 years ago by sdlime

  • status changed from new to assigned

Changed 6 years ago by jmckenna

  • cc yassefa@… added

Changed 6 years ago by zjames

  • cc zjames added

Changed 6 years ago by hobu

  • milestone changed from 5.0 release to 5.2 release

Pushing this forward to 5.2, maybe we can figure out a clean way to deal with it then.

Changed 6 years ago by sdlime

We'll need to stuff the map path in the image object some place OR pass mapObj's around in places we haven't in the past.

Steve

Changed 5 years ago by sdlime

  • cc warmerdam added

Anybody have ideas on how to best address? I see at least three options:

1 - add a new structure member, a pointer back to the parent mapObj to outputFormatObj's 2 - add a new structure member (mappath) to outputFormatObj's to hold the value of mappath from the initializing mapObj 3 - add code to mapfile.c so that mappath is added as a format option in cases where PALETTE= is found.

1 is something we do elsewhere (e.g. layers) and would keep the outputFormatObj in sync with the mapObj and is probably the easiest to implement.

Thoughts?

Steve

Changed 5 years ago by warmerdam

  • description modified (diff)

Steve,

What about changing msSaveImage() to pass the mapObj * down into msSaveImageGD() and msSaveImageGDCtx()? msSaveImageGDAL() already requires the mapObj.

I'm not keen on "back pointers" to the map in objects like the outputFormatObj because they are tricky to keep valid when things are moved around.

Changed 5 years ago by sdlime

Can certainly try that, thanks for the input.

Steve

Changed 5 years ago by sdlime

  • milestone changed from 5.2 release to 5.4 release

Argh, I don't think that will work. The function that mapscript uses to return an image buffer (e.g. msSaveImageBuffer) also needs the mapObj then. Problem is that it would require a change to the mapscript api to make that happen and I don't want to do that. Not for something this insignificant and not for a 5.x release.

We need to keep those function signatures consistent. I knew this would be a pain so I'm deferring until 5.4.

Steve

Changed 5 years ago by warmerdam

Steve,

I see that the mapscript imageObj.save() method takes an optional map argument. Why couldn't the getBytes() and getSize() methods on the imageObj also take this as an optional argument? I don't see how that would be break backward compatability. The current msSaveImageBuffer() really doesn't work properly (as far as I can tell) for situations where a map is required - such as saving to geotiff with georeferencing which requires the mapObj.

Looking at the code I'm somewhat horrified at the duplication between the msSaveImage() functions and the msSaveImageBuffer() functions and the fact that one takes a mapObj and one doesn't - for no apparent reason.

With some care for backward compatability (ie. map mapObj an optional argument) I don't see why this couldn't be done at 5.2 without adverse effects on existing scripts.

Changed 5 years ago by sdlime

  • milestone changed from 5.4 release to 5.2 release

I'm not sure devs even know about msSaveImageBuffer(). It always seems to be out of sync with msSaveImage. Would be nice to have one function with file and buffer-based wrappers. I'll look into optional argument solution. I added everything necessary the other night but stopped when I saw the missing argument to msSaveImageBuffer()...

Will shoot for 5.2.

Steve

Changed 5 years ago by sdlime

Moving to 5.4, no time...

Steve

Changed 5 years ago by sdlime

  • milestone changed from 5.2 release to 5.4 release

Changed 4 years ago by tbonfort

also reported in #2577

Changed 2 years ago by sdlime

  • cc tbonfort added

Thomas, is this an issue with the new rendering code?

Steve

Changed 2 years ago by dmorissette

  • cc assefa, aboudreault added; dgadoury@…, yassefa@… removed
  • milestone changed from 5.6 release to 6.0 release

Moving to 6.0.

Changed 2 years ago by tbonfort

  • status changed from assigned to closed
  • resolution set to fixed

fixed in r11521 for msSaveImage()

The change is not active for msSaveImageBuffer as that would lead to changes in the mapscript api that I am not willing to take on.

closing this one, mapscript users of msSaveImageBuffer that need the functionality can open a new request/bug if needed

Note: See TracTickets for help on using tickets.