Configuring the Feature Report ============================== The feature report generates a printable PDF for a queried feature (for example, a parcel report) or for an entire result set. It reuses the whole print pipeline -- layouts, scale selection, the georeferenced map image, fonts -- and adds two things on top: * the feature's attributes are available to every text element, and * a ``table`` element can be bound to the feature or to the results set instead of carrying literal rows. Adding the report component --------------------------- The report renders in its own modal, added alongside the print modal in ``app.js``: :: app.add(gm3.components.ReportModal, 'report-preview', {}); with a matching element in the page: ::
Opening a report ---------------- Two application methods open a report: * ``app.showFeatureReport(layerPath, filter, options)`` - a report for a single feature. ``filter`` is the same predicate-array form used by ``removeQueryResults``, e.g. ``[['==', 'PIN', '12345']]``. The map is zoomed to the feature first, so the report's map image is centered on it; pass ``{zoomToFeature: false}`` to skip that. * ``app.showResultsReport(layerPath)`` - a report covering every result currently in the layer. The usual place to call the first one is a results-row template, next to the existing zoom/remove/buffer actions: :: The results grid renders its own report button, which calls ``showResultsReport`` for the displayed layer -- no configuration needed. .. note:: The report resolves its feature from the live query results rather than from a copy, so a report always reflects the current selection. Framing the feature ------------------- Fitting the map to a single parcel puts its boundary flat against the edge of the frame, and on a small lot zooms in past whatever imagery the basemap has. ``showFeatureReport`` takes two options to control that: * ``padding`` - pixels of gutter to leave around the feature's extent. Defaults to ``30``. * ``maxScale`` - the largest scale the zoom is allowed to reach, as a scale denominator: ``1200`` stops at 1:1200 (1 inch = 100 feet) no matter how small the feature is. Defaults to ``1200``. Set it to ``null`` to let the map zoom in as far as the feature warrants. :: app.showFeatureReport( 'vector-parcels/parcels', [['==', 'PIN', '{{ properties.PIN }}']], {padding: 60, maxScale: 2400} ) Both settings give the feature more room, from different directions: a wider ``padding`` always leaves a gutter around the feature, however large it is, while ``maxScale`` only ever takes effect on features small enough that the fit would otherwise zoom past it. Raising the ``maxScale`` denominator (``2400``) stops the zoom further out; lowering it (``600``) lets the map get closer before stopping. Both feed the ordinary map fit, so they behave the same as any other zoom-to-extent in GeoMoose. Neither has any effect alongside ``{zoomToFeature: false}``, which leaves the map where the user had it. Defining the layout ------------------- A layer's report layout is a ``report`` template on the layer in the mapbook: ::