[Shake-dev] Image clickmap problem

Bruce Worden bruce at gps.caltech.edu
Fri Aug 3 23:58:10 GMT 2007


Hi Bill,

I have attached a new genex, below.  If you are using ShakeMap V3.2,  
you may substitute it for the one you are currently using.  If you  
are using an earlier version, I've also included a diff that you can  
compare with the new file to see what I added to make this work.  The  
bad news is that I haven't tested it, so you are the guinea pig for  
this little experiment.  Let me know if you have problems.

As for your other question, fiddling with page size is tricky,  
because it isn't just about GMT, but convert and ghostscript also  
come into play.  You can try a different page size (look at the way  
the TV map is handled for some clues), but plan to struggle with it a  
bit.  There is also the possibility that the default page size is  
assumed (and therefore hardwired) in the software somewhere.

Good luck,
Bruce


-------------- next part --------------
A non-text attachment was scrubbed...
Name: genex
Type: application/octet-stream
Size: 32571 bytes
Desc: not available
Url : http://geohazards.usgs.gov/pipermail/shake-dev/attachments/20070803/7d5ee269/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: genex.diffs
Type: application/octet-stream
Size: 1011 bytes
Desc: not available
Url : http://geohazards.usgs.gov/pipermail/shake-dev/attachments/20070803/7d5ee269/attachment-0001.obj 
-------------- next part --------------


On Aug 1, 2007, at 3:23 PM, Bill Gustafson wrote:

> Hi All,
>
> I have a special shakemap product that is a high-resolution  
> shakemap of the Seattle Metropolitan area.  The area that we have  
> selected is narrow and tall relative to the defaults that shakemap  
> usually selects.  You can look at an example here:
>
> http://www.pnsn.org/seashake/shake/0701260923/intensity.html
>
> It's not very interesting but it gets the main idea across.
>
> To get it to fit nicely onto the webpage I have fiddled with the  
> width, xorig, and yorig parameters in mapping.conf.  I have the  
> feeling that this is not the recommended approach (is there one?),  
> because that appears to mess up the clickmaps for the stations.
>
> Here are the values I used:
>
> xorig        : 1.12
> yorig        : 0.6
> width        : 6.25
>
> and here are the defaults:
> xorig        : 1.0
> yorig        : 1.0
> width        : 6.5
>
> Here is a code snippet from ClickMaps.pm that sets up the image  
> clickmaps:
>
> sub imagemap_prep {
>  my $par  = shift;
>  my($fh, at lines,$line,%stas,$sta,$x,$y, at evt,$status,$array,
>     $height_ps,$height);
>
>  my $geom = $par->{'geom'};
>
>  $fh = new IO::File;
>  $fh->open($STATION_LOC_FILE,'r') || Die;
>  @lines = <$fh>;
>  $fh->close;
>  @lines = grep($_ !~ /^\#/, at lines);   # get rid of comment lines
>  @lines = grep($_ !~ /^\s*$/, at lines); # get rid of blank lines
>  chomp(@lines);
>
>  # get some geometry info
>  $height_ps = $geom->{'h'};
>  $height = $height_ps + $JPG_MARGIN{bottom} + $JPG_MARGIN{top};
>  foreach $line (@lines) {
>    ($sta,$x,$y) = split(' ',$line);
>      # add gif/jpg margins
>    $x += $JPG_MARGIN{'left'};
>    $y += $JPG_MARGIN{'bottom'};
>
>    # flip $y (0 at top in gif/jpg)
>    $y = $height - $y;
>
>    # convert from inches to 72 dpi
>    $x = int($x * 72 + 0.5);
>    $y = int($y * 72 + 0.5);
>
>    $stas{$sta} = [$x,$y];
>  }
>
> The critical bits are the JPG_MARGINS, which are set to 1 in  
> Constants.pm, rather than being read from a configuration file.  If  
> I force the left and bottom margins to match those set in  
> mapping.conf, then the clickmaps for the PGA and PGV are correct.   
> There is still the issue of the scalebar height for the  
> intensity.html file, but I think that there is a workaround that is  
> acceptable (I haven't figured it out exactly yet though).
>
> My questions:
>
> Is there a better way to get the images to fit on the web page than  
> fiddling with the xorig, yorig, and width (the issue is that the  
> top of the images are cut off on the intensity.html)?  Should I  
> change the GMT page size (I know very little about GMT), so that  
> it's taller?
> It seems like the JPG_MARGIN values should reflect the xorig and  
> yorig values from mapping, but I'm not sure how to go about that in  
> a general way.  I suppose they could be set as parameters in  
> genex.conf, but it's generally bad form to set the same value in  
> two places, although I would think having the genex program read  
> the mapping.conf file would also be bad form.  I'm happy to work  
> with whoever is now responsible for this code to come up with a  
> fix, but am not sure who I should be talking with.
>
> Thanks,
>
> Bill
>
>
>
> -- 
> Bill Gustafson          Res Eng/Sr Comp Spc
> KSRSL/PNSN              Phone: (206)685-8266/(206)543-8928
> Dept. of Earth and Space Sciences
> Box 351310, UW, Seattle, WA  98195-1310
> http://alumnus.caltech.edu/~billg/bill.htm
>
>
> _______________________________________________
> Shake-dev mailing list
> Shake-dev at scsnmail.gps.caltech.edu
> http://unix1.gps.caltech.edu/mailman/listinfo/shake-dev
>



More information about the Shake-dev mailing list