This repository contains extra components for QWC2.
Plugin for requesting plot information, including Swiss Public-law Restrictions on landownership (PLR) cadastre.
config.json
configuration:
[...]
{
"name": "PlotInfoTool",
"cfg": {
"toolLayers": ["Grundstücke"],
"infoQueries": [
{
"key": "oereb",
"titleMsgId": "oereb.title",
"query": "/oereb/json/$egrid$",
"pdfQuery": "/oereb/pdf/$egrid$",
"pdfTooltip": "oereb.requestPdf",
"urlKey": "oereb_egrid",
"cfg": {
"subthemes": {
"LandUsePlans": ["Grundnutzung", "Überlagerungen", "Linienbezogene Festlegungen", "Objektbezogene Festlegungen"]
}
}
}
]
}
}
[...]
toolLayers
: List of layers to load when activating tool.infoQueries
: List of additional info queries to offer in the dialog (PLR cadastre query is built-in). By default, these render some HTML data in an iframe. If a custom component is needed for rendering the result, see configuration inappConfig.js
below.key
: A unique key name.title
: The human visible title.titleMsgId
: Instead oftitle
, a message id for the title which will be looked up in the translations.query
: The query to perform to retreive the info. Must return HTML, which is then rendered in an iframe.$egrid$
is replaced with the EGRID of the current plot. If the specified URL is relative, it is resolved with respect toplotInfoService
as defined inconfig.json
.pdfQuery
: Optional query to retreive a PDF report, which is then presented as a download the the user. Again,$egrid$
is replaced with the EGRID of the current plot.pdfTooltip
: Message id for the pdf button tooltip.urlKey
: Optional query parameter key name. If QWC2 is started with<urlKey>=<egrid>
in the URL, the plot info tool is automatically enabled and the respective query performed.cfg
: Arbitrary custom config to pass to a custom component, seeappConfig.js
configuration below.
appConfig.js
configuration:
Sample PlotInfoToolPlugin
configuration, as can be defined in the cfg
section of pluginsDef
in appConfig.js
:
PlotInfoToolPlugin: {
themeLayerRestorer: require('./themeLayerRestorer'),
customInfoComponents: {
oereb: require('qwc2-extra/components/OerebDocument')
}
}
-
themeLayerRestorer
: Function which restores theme layers, used for loading thetoolLayers
specified in the configuration inconfig.json
. SeethemeLayerRestorer
in the sampleappConfig.js
. -
customInfoComponents
: Customized components for rendering plot info query results. Thekey
specifies a the info query for which this component should be used, as specified ininfoQueries
in config.json (see above). An example of a minimal custom component:class CustomPlotInfoComponent extends React.Component { static propTypes = { data: PropTypes.object, // PropType according to format of data returned by the specified query URL config: PropTypes.object // Custom configuration } render() { return (<div>{this.props.data.field}</div>); } }; module.exports = CustomPlotInfoComponent;