Opened 17 years ago

Closed 17 years ago

#2222 closed defect (fixed)

shp2img should support setting output size

Reported by: crschmidt Owned by: sdlime
Priority: normal Milestone: 5.0 release
Component: MapServer C Library Version: svn-trunk (development)
Severity: normal Keywords:
Cc: tomkralidis, dmorissette, nsavard@…

Description

add a -s sizex sizey image to shp2img to set the image output size

Attachments (3)

shp2img.patch (1.5 KB ) - added by crschmidt 17 years ago.
add -s support
shp2img-size.map (816 bytes ) - added by crschmidt 17 years ago.
shp2img-size.gif (1.0 KB ) - added by crschmidt 17 years ago.

Download all attachments as: .zip

Change History (22)

by crschmidt, 17 years ago

Attachment: shp2img.patch added

add -s support

comment:1 by crschmidt, 17 years ago

I went to add a test to msautotest, and failed:

  • Even before my changes, 13/32 tests are failing in misc/
  • Doesn't look like there is existing support for adding options to shp2img

I'm running on an AMD64 build -- with that in mind, I'm assuming that the test failures are just rounding errors. (I can confirm, by looking at soe of the images, that they are 'very close' -- within one pixel in all cases I can see.)

I guess this means I need to add more support for options to the shp2img tests.

comment:2 by crschmidt, 17 years ago

Okay, I found out that run_test.sh is totally unused and spurious. Finding this out, I worked out how to set command line options in run-params, and now have a working test. I did this:

  • Reverted everything to SVN mapserver
  • Built clean copy
  • removed all of msautotest/misc/result
  • Ran run_test.py to fill up directory of tests
  • made my change to shp2img
  • reran tests -- confirmed that I got all passes (and one skip)
  • added my test (coming as patch shortly)
  • reran twice to add result and confirm result.

new mapfile and result file coming up shortly, though I'm not sure the result file will be useful due to the above-mentioned 64bit rounding differences.

by crschmidt, 17 years ago

Attachment: shp2img-size.map added

by crschmidt, 17 years ago

Attachment: shp2img-size.gif added

comment:3 by crschmidt, 17 years ago

.map and .gif added -- drop into misc/ and misc/expected.

comment:4 by crschmidt, 17 years ago

The reason for this patch:

Typically, the default size in all my mapfiles is 640x480. However, when generating images via WMS, I typically use tiled images (OpenLayers) so I have 256x256 images. When generating images for bug reports, rather than change my mapfile, I'd like to simply configure the size via the command line to do testing of various sizes. Doing this is currently not possible with the same mapfile -- it requires changing the "SIZE" param of the mapfile. This patch adds the support to change the size via the command line instead.

comment:5 by sdlime, 17 years ago

Status: newassigned

No problem, thanks for the patch and the test. Will add as soon 5.0 branches off.

Steve

comment:6 by crschmidt, 17 years ago

Cool. Thanks.

in reply to:  5 comment:7 by tomkralidis, 17 years ago

Cc: tomkralidis added

Replying to sdlime:

No problem, thanks for the patch and the test. Will add as soon 5.0 branches off.

Steve

Is it too late to put this into 5.0? I know alot of users and scenarios who would benefit from this, in terms of creating tiles against mapfiles w/ shp2img, so being able to set width/height on the command line would be a great feature for 5.0.

comment:8 by sdlime, 17 years ago

Cc: dmorissette added

It's a benign change so it's ok with me. Cc'ing Dan for another opinion. We're looking at another beta anyway.

Steve

comment:9 by dmorissette, 17 years ago

No problem for next beta since it's a trivial change and it's only in shp2img so it doesn't affect the core.

comment:10 by dmorissette, 17 years ago

Milestone: 5.2 release5.0 release

comment:11 by sdlime, 17 years ago

Resolution: fixed
Status: assignedclosed

Added in r6694... Marking as fixed.

Steve

comment:12 by crschmidt, 17 years ago

How do the tests get committed?

comment:13 by crschmidt, 17 years ago

Resolution: fixed
Status: closedreopened

I'd like to see the tests for this go in as well -- is there an additional step I should be taking for that?

comment:14 by tomkralidis, 17 years ago

Cc: nsavard@… added

You can send 'em over (either post here or email). I've cc'd Normand who takes care of msautotest.

comment:15 by crschmidt, 17 years ago

They're already attached as patches to this ticket, which is why I reopened it -- I wanted to make sure they weren't missed.

comment:16 by tomkralidis, 17 years ago

(I'll be okay, really, just need coffee).

I've added the .map file to msautotest/misc/. I get a fail when testing.

[devgeo:/home/tkralidi/foss4g/mapserver/trunk/msautotest/misc]$ ./run_test.py shp2img-size.map 
version = MapServer version 5.0.0-beta5 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=PDF OUTPUT=SWF OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=GEOS INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE

 Processing: shp2img-size.map
*    results dont match, TEST FAILED.
Test done:
    0 tested skipped
    0 tests succeeded
    1 tests failed
    0 test results initialized
[devgeo:/home/tkralidi/foss4g/mapserver/trunk/msautotest/misc]$ ll expected/shp2img-size.gif result/shp2img-size.gif 
-rw-r--r-- 1 tkralidi users 1032 2007-08-24 08:12 expected/shp2img-size.gif
-rw-r--r-- 1 tkralidi users 1029 2007-08-24 07:40 result/shp2img-size.gif

I have not committed the shp2img-size.gif. Normand: can you test as well?

comment:17 by crschmidt, 17 years ago

I'd recommend comparing the two visually: I generated mine on an AMD64 platform, and as I described in earlier comments, 19/33 tests failed for me out of the box. If it fails, dropping the 'expected' image out, and re-running the tests, will generate an image that works which can then be committed (however, this should only be done if you confirm that they are visually the same). The 3 byte difference seems to me like it's just an off-by-one pixel rounding error. (I was hoping uploading a .gif would avoid the problem, since I only had those errors in .jpg, but apparently not.)

in reply to:  17 comment:18 by nsavard, 17 years ago

Replying to crschmidt:

I'd recommend comparing the two visually: I generated mine on an AMD64 platform, and as I described in earlier comments, 19/33 tests failed for me out of the box. If it fails, dropping the 'expected' image out, and re-running the tests, will generate an image that works which can then be committed (however, this should only be done if you confirm that they are visually the same). The 3 byte difference seems to me like it's just an off-by-one pixel rounding error. (I was hoping uploading a .gif would avoid the problem, since I only had those errors in .jpg, but apparently not.)

I ran the test and compared the result with the image downloaded from the patch. They're visually identical. So I committed the new image created.

comment:19 by dmorissette, 17 years ago

Resolution: fixed
Status: reopenedclosed

I believe this can be marked fixed since the test results have been updated by nsavard.

Note: See TracTickets for help on using tickets.