I'm creating a Processing algorithm that requires the user to input several parameters including an input layer and an output CRS. At present, the tool defaults to SRID 4326. I'd like for the CRS parameter to default to whatever layer is selected as the input layer. Is this possible?
I don't see anything in processing.core. Would I have to get into the Qt internals and hook up an event handler for a change in the layer selection?
Current code:
self.addParameter(ParameterCrs(self.TARGET_CRS,
self.tr('Target CRS'), 'EPSG:4326'))
Desired pseudo code:
self.addParameter(ParameterCrs(self.TARGET_CRS,
self.tr('Target CRS'),
processing.parameters.getCrsFromInputLayer(INPUT_LAYER)))
InputLayer.setCrs(QgsCoordinateReferenceSystem(4326, QgsCoordinateReferenceSystem.EpsgCrsId))