<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Brent,<br>
<br>
Thanks for these notes, exactly the type of stuff we're looking for.&nbsp; I
do remember your thread on the graticules BTW.&nbsp; :c) &nbsp;&nbsp; This is also
something of interest to me.&nbsp;&nbsp; The big picture plan is to allow a user
to ultimately plot/print a USNG encoded map per their specification.&nbsp;
There are certainly a lot of other uses for the same sort of labeling
(that I can also use).&nbsp; I'm trying to organize the adds to MapServer so
they are reuseable, or at least set up things so the different types of
labeling are possible with as little additional coding effort as
possible.<br>
<br>
Your method of doing the margins from within the MapFile is an
interesting approach.&nbsp; <br>
<br>
Some general questions to you (and anyone else interested in
commenting):<br>
<br>
* Do you see a need at all to display the grid labels along only two
edges, or even in just two axis but just once, along the center of the
page for example, both vertically and horizontally.<br>
<br>
* Do you see a need to have a variable available for setting the
outside buffer zone area, in other words, for setting how far in (or
possibly out) from the edge of the map,&nbsp; the labels are printed?<br>
<br>
* Do you see a need to have the GRID displayed as a TICed grid instead
of continuous lines, I'm not sure how to actually do this at the
moment. Might be a symbol placement sort of thing, with rotation
instead of line drawing.&nbsp; This is further down the list for me at this
point though.<br>
<br>
* Lastly, do you see a need for an entirely different approach to some
of these labeling/printing aspects, I've been toying with the idea (for
a couple of years now) of building a completely separate service that
can still be complimentary to MapServer and be programmed against in
the same manner from the client side, for templating a print function.&nbsp;
The basic idea would be to build a system where there is a layout
canvas on the client end, that can use URL resources as print objects,
and allows the user to layout where everything goes on a page, which
most likely is some sort of template for printing in pre-defined ways.&nbsp;
Mapserver would handle all the inclusive map grid line markup, but the
real detailed labeling could happen with this separate facility,
specifically for printing.<br>
<br>
In the end, I think this labeling and grid stuff may push me over the
edge as far as trying out some stuff of our own.&nbsp; I would imagine that
we would start with some of the MapServ code to experiment with.&nbsp;&nbsp; I
think our end result might be too heavy to include in mapserv in
general.&nbsp;&nbsp; This GRID stuff though, has elements in both the direct
mapping as well as Print only aspects.<br>
<br>
I've thought a lot about what should be considered a dynamic, online
navigation tool, vs what should be considered a "print" setup tool.&nbsp;
Many pieces cross the line, and that's where it gets murky on how to
start.<br>
<br>
bobb<br>
<br>
<br>
Brent Fraser wrote:
<blockquote cite="mid:.68.144.5.189.1205891167.squirrel@68.144.5.189"
 type="cite">
  <pre wrap="">Bob,

  Good on you for pursuing this!  While I think the current grid object
satisfies most of mapserver implementors' needs, there is room for
improvement.  The ultimate would be a system that can produce reference
system labels like those found on topos (some are very similar to your
NG labels).

First, I see there is still a typo in mapgraticule.c, line 347 (current
SVN) should be

dStartY              = (pInfo-&gt;pboundinglines[0].point[1].y -
pInfo-&gt;pboundinglines[0].point[0].y) * dDeltaX +
pInfo-&gt;pboundinglines[0].point[0].y;

(note the last array index value of 0 not 1)

Second, (from my old notes on experimenting with labeling in v4.3) I
changed 661 thru 682 to:

  switch( ePosition )
  {
    case posBottom:
      pShape-&gt;line-&gt;point[1].y = pLayer-&gt;map-&gt;height;
      pShape-&gt;line-&gt;point[0].y = pLayer-&gt;map-&gt;height - (
fabs(rectLabel.maxx - rectLabel.minx) + 15 );  /* rectLabel is based
on non-rotated text (x is along the width of text) */
      break;

    case posTop:
      pShape-&gt;line-&gt;point[1].y = 0;
      pShape-&gt;line-&gt;point[0].y = fabs(rectLabel.maxx - rectLabel.minx) + 15;
      break;

    case posLeft:
      pShape-&gt;line-&gt;point[1].x = 0;
      pShape-&gt;line-&gt;point[0].x = fabs(rectLabel.maxx - rectLabel.minx) + 15;
      break;

    case posRight:
      pShape-&gt;line-&gt;point[1].x = pLayer-&gt;map-&gt;width;
      pShape-&gt;line-&gt;point[0].x = pLayer-&gt;map-&gt;width - (
fabs(rectLabel.maxx - rectLabel.minx) + 15 );
      break;
  }



And regarding labeling "outside" the map, I arranged my map file to draw:
1. all the usual raster and vector layers
2. a grid layer
3. a "margin" layer of blanking polygons (see below)
4. a grid layer of type annotation so no lines are drawn


Here's part of my map file (for version 4.3 so no telling what will happen
with v5.x):

SIZE 800 600
    :
    :

LAYER
  NAME "Margin"
  TRANSFORM FALSE
  STATUS DEFAULT
  TYPE POLYGON
  CLASS
     COLOR 255 255 255
  END
  FEATURE
     POINTS 0 0 0 600 70 600 70 0 0 0 END
     POINTS 70 0 70 70 800 70 800 0 70 0 END
     POINTS 70 600 800 600 800 530 70 530 70 600 END
     POINTS 730 70 730 530 800 530 800 70 730 70 END
  END
END

#-----------------------------------------------------------
LAYER
  NAME "NeatLine"
  TRANSFORM FALSE
  STATUS DEFAULT
  TYPE LINE
  CLASS
     COLOR 0 0 0
  END
  FEATURE
     POINTS 70 70 70 530 730 530 730 70 70 70 END
  END
END


#-----------------------------------------------------------
LAYER
  NAME "GRID"
  PROJECTION
          "proj=latlong"
#          "ellps=sphere"
          "datum=WGS84"
  END
#  TYPE Line
  TYPE ANNOTATION
#  LABELCACHE off
  STATUS DEFAULT
  CLASS
        COLOR 128 128 128
#          LABEL
#                TYPE BITMAP
#                SIZE MEDIUM
#                COLOR 128 128 89
#          END
        LABEL
          color 0 0 0
#          COLOR 255 255 0
#          OUTLINECOLOR 0 0 0
          TYPE TRUETYPE
          FONT arial  #bd
          SIZE 12
          POSITION UC # AUTO
          ANGLE AUTO
#          OFFSET 4 4
#          PARTIALS false
#          WRAP " "
        END # Label
  END

  GRID
    LABELFORMAT "DDMM"
#    LABELFORMAT "DDMMSS"
#    MINSUBDIVIDE 6
#    MAXSUBDIVIDE 6
#    MININTERVAL 1.0
#    MAXINTERVAL 1.0
#    MINARCS 6
#    MAXARCS 6
  END
END

#-----------------------------------------------------------

END  # MAPFILE


  But in the end it is somewhat hacky and not perfect.  I think some
additional objects and properties are needed.  Last year I had a small
rant regarding graticules on the OSGeo mailing list (with no specific
solution reached).  Here's one record of it:

<a class="moz-txt-link-freetext" href="http://www.mail-archive.com/discuss@lists.osgeo.org/msg00935.html">http://www.mail-archive.com/discuss@lists.osgeo.org/msg00935.html</a>

Keep up the good work!
Brent Fraser

  </pre>
  <blockquote type="cite">
    <pre wrap="">All,

I've (we've) been messing with this GRID object and Labeling while trying
to get a USNG grid output with labels

The results are meant to look like the left edge of the attached image.
The other three sides are being repositioned by some semi-known process.

Essentially the labels should be:

First two characters are super-scripted, the next two characters are
Normal, and the last four are also super-scripted.   We've mussed with
MapServer code and come up with a method for handling the different
styling via a layer in the MAPFILE, using  a LABELFORMAT option of NG1(1st
2 chars), NG2 (2nd 2 chars) and NG3 (the last 4 chars).  This is set up
along the lines of the DDMMSS options for LAT/LON.

You can see that there is something wonky about the justification of the
labels.  Right now we have space padding in front of and behind the
superscripted items, we'll address that separately once we get past this
label justification thing.

So the question is, what is the sequence of events for a GRID with labels,
being applied to the result?  Where in the Code could/should the
justifications be eliminated for the GRID writing process (I understand
that there needs to be a process for aligning along the edges) so that the
regular Labeling parameters, specifically, the OFFSET param, are adhered
to.

I've tried all sorts of different combinations of settings to get the
right output, and I can only seem to get one edge to display properly.

Furthering this output option a little more, anyone done any work with
labeling along the outside of a map image?  I could use an option like
this for printing for example.

Thanks

bobb


The image results are from using this MapFile:

MAP
  NAME 'USNG'
  SIZE 800 650
  STATUS ON
  ##IMAGECOLOR 254 254 254
  ##EXTENT 540000 135000 600000 175000
  EXTENT 593133.398829 170094.734526 593893.148973 170712.010326
  UNITS FEET

  FONTSET ./0000_00/MN_Line_Experiments/fonts/font.list
  SYMBOLSET ./0000_00/MN_Line_Experiments/symbols/symbol.list

  TRANSPARENT TRUE
  IMAGETYPE PNG

  WEB
    IMAGEPATH "/mnt/VECTOR00/output/"
    IMAGEURL "/tmp/"
  END

# EPSG:26915

  LAYER
    NAME "grid"
    TYPE LINE
    STATUS DEFAULT
    CLASS
      NAME "Graticule"
      COLOR 0 0 0
      SYMBOL 'circle'
      SIZE 1
    END
    PROJECTION
      "init=epsg:26915"
    END
    GRID
      LABELFORMAT "NG1"
    END
  END

  LAYER
    NAME "ng1"
    TYPE LINE
    STATUS DEFAULT
    CLASS
      LABEL
        COLOR  0 0 0
        FONT mono
        TYPE truetype
        SIZE 6
        OUTLINECOLOR 255 255 254
        FORCE true
        POSITION cl
        #OFFSET 0 0
      END
    END
    PROJECTION
      "init=epsg:26915"
    END
    GRID
      LABELFORMAT "NG1"
    END
  END

  LAYER
    NAME "ng2"
    TYPE LINE
    STATUS DEFAULT
    CLASS
      LABEL
        COLOR  0 0 0
        FONT mono
        TYPE truetype
        SIZE 12
        OUTLINECOLOR 255 255 254
        FORCE true
        POSITION cl
      END
    END
    PROJECTION
      "init=epsg:26915"
    END
    GRID
      LABELFORMAT "NG2"
    END
  END

  LAYER
    NAME "ng3"
    TYPE LINE
    STATUS DEFAULT
    CLASS
      LABEL
        COLOR  0 0 0
        FONT mono
        TYPE truetype
        SIZE 6
        OUTLINECOLOR 255 255 254
        FORCE true
        #OFFSET 0 0
        POSITION cl
      END
    END
    PROJECTION
      "init=epsg:26915"
    END
    GRID
      LABELFORMAT "NG3"
    END
  END


END ## end Map

_______________________________________________
mapserver-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/mapserver-users">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a>


    </pre>
  </blockquote>
  <pre wrap=""><!---->

_______________________________________________
mapserver-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/mapserver-users">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a>


  </pre>
</blockquote>
</body>
</html>