Ticket #2222 (closed defect: fixed)

Opened 6 years ago

Last modified 6 years ago

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

shp2img.patch Download (1.5 KB) - added by crschmidt 6 years ago.
add -s support
shp2img-size.map Download (0.8 KB) - added by crschmidt 6 years ago.
shp2img-size.gif Download (1.0 KB) - added by crschmidt 6 years ago.

Change History

Changed 6 years ago by crschmidt

add -s support

  Changed 6 years ago by crschmidt

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.

  Changed 6 years ago by crschmidt

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.

Changed 6 years ago by crschmidt

Changed 6 years ago by crschmidt

  Changed 6 years ago by crschmidt

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

  Changed 6 years ago by crschmidt

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.

follow-up: ↓ 7   Changed 6 years ago by sdlime

  • status changed from new to assigned

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

Steve

  Changed 6 years ago by crschmidt

Cool. Thanks.

in reply to: ↑ 5   Changed 6 years ago by tomkralidis

  • 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.

  Changed 6 years ago by sdlime

  • 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

  Changed 6 years ago by dmorissette

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

  Changed 6 years ago by dmorissette

  • milestone changed from 5.2 release to 5.0 release

  Changed 6 years ago by sdlime

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

Added in r6694... Marking as fixed.

Steve

  Changed 6 years ago by crschmidt

How do the tests get committed?

  Changed 6 years ago by crschmidt

  • status changed from closed to reopened
  • resolution fixed deleted

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

  Changed 6 years ago by tomkralidis

  • cc nsavard@… added

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

  Changed 6 years ago by crschmidt

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

  Changed 6 years ago by tomkralidis

(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?

follow-up: ↓ 18   Changed 6 years ago by 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.)

in reply to: ↑ 17   Changed 6 years ago by nsavard

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.

  Changed 6 years ago by dmorissette

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

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

Note: See TracTickets for help on using tickets.