Configuring Print Scales¶
The fixed scales offered in the print dialog can be set via the
application configuration’s print.scales. The “Scale to fit” options
are always available; when print.scales is omitted a built-in set of
common scales is used.
The configuration is passed to the gm3.Application constructor in your
app.js.
var app = new gm3.Application({
mapserver_url: CONFIG.mapserver_url,
mapfile_root: CONFIG.mapfile_root,
print: {
scales: [
{scale: 50},
{scale: 1000},
{scale: 24000},
{label: "1000 ft / in", metersPerPt: 4.2333}
]
}
});
To offer only the “Scale to fit” options and no fixed scales, set
scales to an empty array:
var app = new gm3.Application({
mapserver_url: CONFIG.mapserver_url,
mapfile_root: CONFIG.mapfile_root,
print: {
scales: []
}
});
Each entry sets the scale one of two ways:
scale- A1:Nratio (e.g.24000for1:24000). Simplest, and the natural fit for metric printing.metersPerPt- The ground distance, in meters, that one PDF point of paper represents (72 points per inch). For “per inch” scales, divide the per-inch distance by 72:1000 ft / inis1000 * 0.3048 / 72.
label is optional; a 1:N label is derived from the scale when
omitted.
The built-in scales¶
When print.scales is omitted, the engineering scales below are
offered. They cover the US local-government use cases discussed in
geomoose/gm3#999. Set
print.scales to replace the list outright with your own – for
metric printing, or to reach the regional scales (1 mile per inch,
1:100000) that the defaults stop short of.
Because a foot is exactly 12 inches, every “feet per inch” scale is an
exact 1:N ratio, so each can be reproduced with the simpler
scale form:
Scale |
|
Typical use |
|---|---|---|
1 inch = 10 feet |
|
Septic evaluations and permits |
1 inch = 20 feet |
|
Intersection layouts, utility alignments |
1 inch = 40 feet |
|
Residential streets, general utility plans |
1 inch = 50 feet |
|
Grading plans, larger parcels, subdivision layouts |
1 inch = 100 feet |
|
City-wide overviews, long right-of-way maps |
1 inch = 200 feet |
|
Planning and zoning maps |
1 inch = 300 feet |
|
|
1 inch = 400 feet |
|
|
1 inch = 500 feet |
|
USNG and fire maps (a 1 km square fits on letter) |
1 inch = 600 feet |
|
|
1 inch = 2000 feet |
|
7.5 minute USGS topographic quadrangle |
Note
Scales assume a basemap in meters (web mercator) and are true at the map center; like any web-mercator map, scale distorts toward the poles.
Zoom restrictions and the offered scales¶
Printing at a fixed scale re-renders the map at the resolution that scale
requires. The print map is rendered by the same map component as the main
map, so it inherits any map.view zoom restrictions – and a scale
finer than those restrictions permit cannot be honored.
var app = new gm3.Application({
map: {
view: {
maxZoom: 20
}
}
});
With maxZoom: 20, a request for 1 inch = 10 feet cannot be met:
OpenLayers clamps the render at the zoom-20 limit, and the map comes out
several times coarser than asked for.
The same applies at the other end. view.extent caps how far out the
map can zoom – the extent has to fit the printed map’s pixel size – so
a very coarse scale on a tightly bounded map is equally unreachable.
Unreachable scales are not offered. GeoMoose tests each configured scale against the view’s limits and leaves out the ones it cannot honor, so a user cannot select a scale the print would silently fail to deliver. Any dropped scales are named in the print dialog and in the browser console.
Warning
A scale you configured can therefore be missing from the print dialog on some layouts and present on others – the check depends on the size of the layout’s map element as well as on the zoom limits.
The fix is to make the settings agree: either widen the zoom limits far
enough to reach your finest and coarsest scales, or set print.scales
so only reachable scales are offered.
The printed scale caption is drawn only for a scale that passed this check – see the Scale line option in Configuring the Scale Line.