Exemplo n.º 1
0
    def populateGps(self):
        """Populate the labels with the GPS coordinates of this parcel.

        Set them based on the coordinates of the centroid of the parcel,
        taking the degrees/dms settings into account.
        """
        def rewriteText(t):
            tl = [i for i in t.split(',')]
            r = tl[1] + '<br>' + tl[0]
            return r

        if self.feature:
            gpsGeom = QGisCore.QgsGeometry(self.feature.geometry().centroid())
            gpsGeom.transform(
                QGisCore.QgsCoordinateTransform(
                    QGisCore.QgsCoordinateReferenceSystem(
                        31370,
                        QGisCore.QgsCoordinateReferenceSystem.EpsgCrsId),
                    QGisCore.QgsCoordinateReferenceSystem(
                        4326,
                        QGisCore.QgsCoordinateReferenceSystem.EpsgCrsId)))
            dms = self.main.qsettings.value(
                '/Qgis/plugins/Erosiebezwaren/gps_dms', 'false')
            if dms == 'true':
                self.lbv_gps.setText(
                    rewriteText(gpsGeom.asPoint().toDegreesMinutesSeconds(2)))
            else:
                self.lbv_gps.setText(
                    rewriteText(gpsGeom.asPoint().toDegreesMinutes(3)))
        else:
            self.lbv_gps.clear()
Exemplo n.º 2
0
 def draw_help_circle(self):
     """change diameter of circular rubberband"""
     if self.parent.straal_button.isChecked() and self.capturing:
         straal = self.parent.straal.value()
         startPt = self.capturedPoints[-1]
         circle = QC.QgsCircle(QC.QgsPoint(startPt), straal)
         cString = circle.toCircularString()
         geom_from_curve = QC.QgsGeometry(cString)
         self.roundRubberBand.setToGeometry(geom_from_curve)
         self.snapRubberBand.append(self.roundRubberBand.asGeometry())
Exemplo n.º 3
0
 def addTMS():
     geomTransf = QgsCore.QgsGeometry(feat.geometry())
     geomTransf.transform(self.ct)
     wkt_geom = geomTransf.exportToWkt()
     layer = QgsCore.QgsRasterLayer(image, os.path.split(image)[-1])
     layer.setCustomProperty('wkt_geom', wkt_geom)
     layer.setCustomProperty('date', feat['acquired'])
     layer.setCustomProperty('id_table', self.id_table)
     layer.setCustomProperty('id_image', feat['id'])
     QgsCore.QgsMapLayerRegistry.instance().addMapLayer(
         layer, addToLegend=False)
     self.ltgCatalog.addLayer(layer).setVisible(QtCore.Qt.Unchecked)
     self.legendRasterGeom.setLayer(layer)
Exemplo n.º 4
0
 def addImage():
     layer = QgsCore.QgsRasterLayer(file_image,
                                    os.path.split(file_image)[-1])
     geomTransf = QgsCore.QgsGeometry(geom)
     ct = QgsCore.QgsCoordinateTransform(v_crs, layer.crs())
     geomTransf.transform(ct)
     wkt_geom = geomTransf.exportToWkt()
     layer.setCustomProperty('wkt_geom', wkt_geom)
     layer.setCustomProperty('date', acquired)
     layer.setCustomProperty('id_table', id_table)
     layer.setCustomProperty('id_image', id_image)
     QgsCore.QgsMapLayerRegistry.instance().addMapLayer(
         layer, addToLegend=False)
     self.catalog['ltg'].addLayer(layer)
     self.legendRasterGeom.setLayer(layer)