当前位置: 首页>>代码示例>>Python>>正文


Python QVariant.String方法代码示例

本文整理汇总了Python中qgis.PyQt.QtCore.QVariant.String方法的典型用法代码示例。如果您正苦于以下问题:Python QVariant.String方法的具体用法?Python QVariant.String怎么用?Python QVariant.String使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在qgis.PyQt.QtCore.QVariant的用法示例。


在下文中一共展示了QVariant.String方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: initAlgorithm

# 需要导入模块: from qgis.PyQt.QtCore import QVariant [as 别名]
# 或者: from qgis.PyQt.QtCore.QVariant import String [as 别名]
def initAlgorithm(self, config):
        self.addParameter(
            QgsProcessingParameterFeatureSource(
                self.PrmInputLayer,
                'Input vector layer or table',
                [QgsProcessing.TypeVector])
        )
        self.addParameter(
            QgsProcessingParameterField(
                self.PrmPlusCodesField,
                'Field containing Plus Code coordinate',
                defaultValue='pluscodes',
                parentLayerParameterName=self.PrmInputLayer,
                type=QgsProcessingParameterField.String)
        )
        self.addParameter(
            QgsProcessingParameterFeatureSink(
                self.PrmOutputLayer,
                'Output layer')
        ) 
开发者ID:NationalSecurityAgency,项目名称:qgis-latlontools-plugin,代码行数:22,代码来源:pluscodes.py

示例2: addpoint

# 需要导入模块: from qgis.PyQt.QtCore import QVariant [as 别名]
# 或者: from qgis.PyQt.QtCore.QVariant import String [as 别名]
def addpoint(self, feature):
        if self.cntPt == 0:
            f = QgsFields()
            f.append(QgsField("name", QVariant.String))
            f.append(QgsField("folders", QVariant.String))
            f.append(QgsField("description", QVariant.String))
            f.append(QgsField("altitude", QVariant.Double))
            f.append(QgsField("alt_mode", QVariant.String))
            f.append(QgsField("time_begin", QVariant.String))
            f.append(QgsField("time_end", QVariant.String))
            f.append(QgsField("time_when", QVariant.String))
            for item in self.extData:
                f.append(QgsField(item, QVariant.String))
            (self.sinkPt, self.dest_id_pt) = self.parameterAsSink(
                self.parameters,
                self.PrmPointOutputLayer, self.context, f,
                QgsWkbTypes.PointZ, epsg4326)

        self.cntPt += 1
        self.sinkPt.addFeature(feature) 
开发者ID:NationalSecurityAgency,项目名称:qgis-kmltools-plugin,代码行数:22,代码来源:importKml.py

示例3: addline

# 需要导入模块: from qgis.PyQt.QtCore import QVariant [as 别名]
# 或者: from qgis.PyQt.QtCore.QVariant import String [as 别名]
def addline(self, feature):
        if self.cntLine == 0:
            f = QgsFields()
            f.append(QgsField("name", QVariant.String))
            f.append(QgsField("folders", QVariant.String))
            f.append(QgsField("description", QVariant.String))
            f.append(QgsField("altitude", QVariant.Double))
            f.append(QgsField("alt_mode", QVariant.String))
            f.append(QgsField("time_begin", QVariant.String))
            f.append(QgsField("time_end", QVariant.String))
            f.append(QgsField("time_when", QVariant.String))
            for item in self.extData:
                f.append(QgsField(item, QVariant.String))
            (self.sinkLine, self.dest_id_line) = self.parameterAsSink(
                self.parameters,
                self.PrmLineOutputLayer, self.context, f,
                QgsWkbTypes.MultiLineStringZ, epsg4326)

        self.cntLine += 1
        self.sinkLine.addFeature(feature) 
开发者ID:NationalSecurityAgency,项目名称:qgis-kmltools-plugin,代码行数:22,代码来源:importKml.py

示例4: addpolygon

# 需要导入模块: from qgis.PyQt.QtCore import QVariant [as 别名]
# 或者: from qgis.PyQt.QtCore.QVariant import String [as 别名]
def addpolygon(self, feature):
        if self.cntPoly == 0:
            f = QgsFields()
            f.append(QgsField("name", QVariant.String))
            f.append(QgsField("folders", QVariant.String))
            f.append(QgsField("description", QVariant.String))
            f.append(QgsField("altitude", QVariant.Double))
            f.append(QgsField("alt_mode", QVariant.String))
            f.append(QgsField("time_begin", QVariant.String))
            f.append(QgsField("time_end", QVariant.String))
            f.append(QgsField("time_when", QVariant.String))
            for item in self.extData:
                f.append(QgsField(item, QVariant.String))
            (self.sinkPoly, self.dest_id_poly) = self.parameterAsSink(
                self.parameters,
                self.PrmPolygonOutputLayer, self.context, f,
                QgsWkbTypes.MultiPolygonZ, epsg4326)
        self.cntPoly += 1
        self.sinkPoly.addFeature(feature) 
开发者ID:NationalSecurityAgency,项目名称:qgis-kmltools-plugin,代码行数:21,代码来源:importKml.py

示例5: __init__

# 需要导入模块: from qgis.PyQt.QtCore import QVariant [as 别名]
# 或者: from qgis.PyQt.QtCore.QVariant import String [as 别名]
def __init__(self, iface, parent):
        """ Constructor to initialize the circular heatmap dialog box """
        super(HeatmapDialog, self).__init__(parent)
        self.setupUi(self)
        self.iface = iface
        self.canvas = iface.mapCanvas()
        self.layerComboBox.setFilters(QgsMapLayerProxyModel.VectorLayer)
        self.layerComboBox.layerChanged.connect(self.userSelectsLayer)
        self.dtComboBox.setFilters(QgsFieldProxyModel.String | QgsFieldProxyModel.Date | QgsFieldProxyModel.Time)
        self.dateComboBox.setFilters(QgsFieldProxyModel.String | QgsFieldProxyModel.Date)
        self.timeComboBox.setFilters(QgsFieldProxyModel.String | QgsFieldProxyModel.Time)
        self.categoryComboBox.setFilters(QgsFieldProxyModel.String | QgsFieldProxyModel.Numeric)
        self.dtRadioButton.clicked.connect(self.enableComponents)
        self.notdtRadioButton.clicked.connect(self.enableComponents)
        self.radialComboBox.addItems(OPTIONMENU)
        self.circleComboBox.addItems(OPTIONMENU)
        self.buttonBox.button(QDialogButtonBox.Ok).setText("Create Chart")
        self.buttonBox.button(QDialogButtonBox.Help).clicked.connect(self.help) 
开发者ID:NationalSecurityAgency,项目名称:qgis-d3datavis-plugin,代码行数:20,代码来源:heatmapDialog.py

示例6: processAlgorithm

# 需要导入模块: from qgis.PyQt.QtCore import QVariant [as 别名]
# 或者: from qgis.PyQt.QtCore.QVariant import String [as 别名]
def processAlgorithm(self, parameters, context, feedback):
        input_layer = self.parameterAsSource(parameters, self.INPUT, context)
        traj_id_field = self.parameterAsFields(parameters, self.TRAJ_ID_FIELD, context)[0]
        timestamp_field = self.parameterAsFields(parameters, self.TIMESTAMP_FIELD, context)[0]
        timestamp_format = self.parameterAsString(parameters, self.TIMESTAMP_FORMAT, context)
        
        output_fields = QgsFields()
        output_fields.append(QgsField(traj_id_field, QVariant.String))
        
        (sink, dest_id) = self.parameterAsSink(parameters, self.OUTPUT, context,
                                               output_fields, 
                                               QgsWkbTypes.LineStringM, 
                                               input_layer.sourceCrs())
        
        trajectories = trajectories_from_qgis_point_layer(input_layer, timestamp_field, traj_id_field, timestamp_format)
        
        for traj in trajectories:
            line = QgsGeometry.fromWkt(traj.to_linestringm_wkt())
            f = QgsFeature()
            f.setGeometry(line)
            f.setAttributes([traj.id])
            sink.addFeature(f, QgsFeatureSink.FastInsert)
        
        # default return type for function
        return {self.OUTPUT: dest_id} 
开发者ID:anitagraser,项目名称:qgis-processing-trajectory,代码行数:27,代码来源:trajectoriesFromPointLayerAlgorithm.py

示例7: createPointLayerReverse

# 需要导入模块: from qgis.PyQt.QtCore import QVariant [as 别名]
# 或者: from qgis.PyQt.QtCore.QVariant import String [as 别名]
def createPointLayerReverse(self):
        layername = self.layerLineEdit.text()
        self.pointLayer = QgsVectorLayer("point?crs=epsg:4326", layername, "memory")
        self.provider = self.pointLayer.dataProvider()
        if self.detailedAddressCheckBox.checkState():
            self.provider.addAttributes([
                QgsField("osm_type", QVariant.String),
                QgsField("osm_id", QVariant.String),
                QgsField("display_name", QVariant.String),
                QgsField("house_number", QVariant.String),
                QgsField("road", QVariant.String),
                QgsField("neighbourhood", QVariant.String),
                QgsField("locality", QVariant.String),
                QgsField("town", QVariant.String),
                QgsField("city", QVariant.String),
                QgsField("county", QVariant.String),
                QgsField("state", QVariant.String),
                QgsField("postcode", QVariant.String),
                QgsField("country", QVariant.String),
                QgsField("country_code", QVariant.String)])
        else:
            self.provider.addAttributes([QgsField("display_name", QVariant.String)])
        self.pointLayer.updateFields()
        if self.showLabelCheckBox.checkState():
            # Display labels
            label = QgsPalLayerSettings()
            label.fieldName = 'display_name'
            label.placement= QgsPalLayerSettings.AroundPoint
            labeling = QgsVectorLayerSimpleLabeling(label)
            self.pointLayer.setLabeling(labeling)
            self.pointLayer.setLabelsEnabled(True) 
开发者ID:NationalSecurityAgency,项目名称:qgis-bulk-nominatim,代码行数:33,代码来源:bulkDialog.py

示例8: createPointLayer

# 需要导入模块: from qgis.PyQt.QtCore import QVariant [as 别名]
# 或者: from qgis.PyQt.QtCore.QVariant import String [as 别名]
def createPointLayer(self):
        layername = self.layerLineEdit.text()
        self.pointLayer = QgsVectorLayer("point?crs=epsg:4326", layername, "memory")
        self.provider = self.pointLayer.dataProvider()
        if self.detailedAddressCheckBox.checkState():
            self.provider.addAttributes([
                QgsField("osm_type", QVariant.String),
                QgsField("osm_id", QVariant.String),
                QgsField("class", QVariant.String),
                QgsField("type", QVariant.String),
                QgsField("source_addr", QVariant.String),
                QgsField("display_name", QVariant.String),
                QgsField("house_number", QVariant.String),
                QgsField("road", QVariant.String),
                QgsField("neighbourhood", QVariant.String),
                QgsField("locality", QVariant.String),
                QgsField("town", QVariant.String),
                QgsField("city", QVariant.String),
                QgsField("county", QVariant.String),
                QgsField("state", QVariant.String),
                QgsField("postcode", QVariant.String),
                QgsField("country", QVariant.String),
                QgsField("country_code", QVariant.String)])
        else:
            self.provider.addAttributes([QgsField("display_name", QVariant.String)])
        self.pointLayer.updateFields()
        if self.showLabelCheckBox.checkState():
            # Display labels
            label = QgsPalLayerSettings()
            label.fieldName = 'display_name'
            label.placement= QgsPalLayerSettings.AroundPoint
            labeling = QgsVectorLayerSimpleLabeling(label)
            self.pointLayer.setLabeling(labeling)
            self.pointLayer.setLabelsEnabled(True) 
开发者ID:NationalSecurityAgency,项目名称:qgis-bulk-nominatim,代码行数:36,代码来源:bulkDialog.py

示例9: createLayer

# 需要导入模块: from qgis.PyQt.QtCore import QVariant [as 别名]
# 或者: from qgis.PyQt.QtCore.QVariant import String [as 别名]
def createLayer(self):
        '''Create a memory layer from the zoom to locations'''
        rowcnt = self.resultsTable.rowCount()
        if rowcnt == 0:
            return
        attr = []
        for item, label in enumerate(LABELS[0:self.numCol]):
            label = label.lower()
            if item <= 1:
                attr.append(QgsField(label, QVariant.Double))
            else:
                attr.append(QgsField(label, QVariant.String))
        ptLayer = QgsVectorLayer("Point?crs=epsg:4326", u"Lat Lon Locations", "memory")
        provider = ptLayer.dataProvider()
        provider.addAttributes(attr)
        ptLayer.updateFields()

        for id in range(rowcnt):
            item = self.resultsTable.item(id, 0).data(Qt.UserRole)
            feature = QgsFeature()
            feature.setGeometry(QgsGeometry.fromPointXY(QgsPointXY(item.lon, item.lat)))
            attr = [item.lat, item.lon, item.label]
            for i in range(3, self.numCol):
                attr.append(item.data[i - 3])
            feature.setAttributes(attr)
            provider.addFeatures([feature])

        ptLayer.updateExtents()
        if self.settings.multiZoomStyleID == 1:
            settings = QgsPalLayerSettings()
            settings.fieldName = 'label'
            settings.placement = QgsPalLayerSettings.AroundPoint
            labeling = QgsVectorLayerSimpleLabeling(settings)
            ptLayer.setLabeling(labeling)
            ptLayer.setLabelsEnabled(True)
        elif self.settings.multiZoomStyleID == 2 and os.path.isfile(self.settings.customQMLFile()):
            ptLayer.loadNamedStyle(self.settings.customQMLFile())

        QgsProject.instance().addMapLayer(ptLayer) 
开发者ID:NationalSecurityAgency,项目名称:qgis-latlontools-plugin,代码行数:41,代码来源:multizoom.py

示例10: getFeatureFromPointParameter

# 需要导入模块: from qgis.PyQt.QtCore import QVariant [as 别名]
# 或者: from qgis.PyQt.QtCore.QVariant import String [as 别名]
def getFeatureFromPointParameter(qgs_point_xy):     
    feature = QgsFeature()
    fields = QgsFields()
    fields.append(QgsField('point_id', QVariant.String, '', 254, 0))
    feature.setFields(fields)
    feature.setGeometry(QgsGeometry.fromPointXY(qgs_point_xy))
    feature['point_id']="Start Point"
    return feature 
开发者ID:root676,项目名称:QNEAT3,代码行数:10,代码来源:Qneat3Utilities.py

示例11: getFieldDatatypeFromPythontype

# 需要导入模块: from qgis.PyQt.QtCore import QVariant [as 别名]
# 或者: from qgis.PyQt.QtCore.QVariant import String [as 别名]
def getFieldDatatypeFromPythontype(pythonvar):
    if isinstance(pythonvar, str):
        return QVariant.String
    elif isinstance(pythonvar, int):
        return QVariant.Int
    elif isinstance(pythonvar, float):
        return QVariant.Double
    else: 
        return QVariant.String 
开发者ID:root676,项目名称:QNEAT3,代码行数:11,代码来源:Qneat3Utilities.py

示例12: _toQgsField

# 需要导入模块: from qgis.PyQt.QtCore import QVariant [as 别名]
# 或者: from qgis.PyQt.QtCore.QVariant import String [as 别名]
def _toQgsField(f):
    ''' Create QgsFiel '''
    if isinstance(f, QgsField):
        return f
    return QgsField(f[0], TYPE_MAP.get(f[1], QVariant.String)) 
开发者ID:All4Gis,项目名称:QGISFMV,代码行数:7,代码来源:QgsFmvLayers.py

示例13: initAlgorithm

# 需要导入模块: from qgis.PyQt.QtCore import QVariant [as 别名]
# 或者: from qgis.PyQt.QtCore.QVariant import String [as 别名]
def initAlgorithm(self, config):
        self.addParameter(
            QgsProcessingParameterFeatureSource(
                self.PrmInputLayer,
                tr('Input layer'),
                [QgsProcessing.TypeVector])
        )
        self.addParameter(
            QgsProcessingParameterField(
                self.PrmDescriptionField,
                tr('Description field'),
                defaultValue='description',
                parentLayerParameterName=self.PrmInputLayer,
                type=QgsProcessingParameterField.String
            )
        )
        self.addParameter(
            QgsProcessingParameterString(
                self.PrmExpansionTags,
                tr('Comma separated list of expansion tags - Left blank autogenerates all tags'),
                optional=True)
        )
        self.addParameter(
            QgsProcessingParameterEnum(
                self.PrmExpansionType,
                tr('How to expand the description field'),
                options=[tr('Expand from a 2 column HTML table'),
                    tr('Expand from "tag = value" pairs'),
                    tr('Expand from "tag: value" pairs')],
                defaultValue=0,
                optional=False)
        )
        self.addParameter(
            QgsProcessingParameterFeatureSink(
                self.PrmOutputLayer,
                tr('Output layer'))
        ) 
开发者ID:NationalSecurityAgency,项目名称:qgis-kmltools-plugin,代码行数:39,代码来源:htmlExpansionDialog.py

示例14: processAlgorithm

# 需要导入模块: from qgis.PyQt.QtCore import QVariant [as 别名]
# 或者: from qgis.PyQt.QtCore.QVariant import String [as 别名]
def processAlgorithm(self, parameters, context, feedback):
        source = self.parameterAsSource(parameters, self.PrmInputLayer, context)
        field = self.parameterAsString(parameters, self.PrmDescriptionField, context)
        tags = self.parameterAsString(parameters, self.PrmExpansionTags, context).strip()
        type = self.parameterAsInt(parameters, self.PrmExpansionType, context)
        feedback.pushInfo(tags)
        if not field:
            msg = tr('Must have a valid description field')
            feedback.reportError(msg)
            raise QgsProcessingException(msg)

        # Set up the HTML expansion processor
        self.htmlProcessor = HTMLExpansionProcess(source, field, type)
        self.htmlProcessor.addFeature.connect(self.addFeature)
        # Have it generate a list of all possible expansion field names
        if self.PrmExpansionTags in parameters and tags != '':
            expansionNames = [x.strip() for x in tags.split(',')]
            feedback.pushInfo('{}'.format(expansionNames))
            self.htmlProcessor.setDesiredFields(expansionNames)
        else:
            self.htmlProcessor.autoGenerateFileds()

        srcCRS = source.sourceCrs()
        wkbtype = source.wkbType()

        # Create a copy of the fields for the output
        fieldsout = QgsFields(source.fields())
        for item in self.htmlProcessor.uniqueDesiredNames(source.fields().names()):
            fieldsout.append(QgsField(item, QVariant.String))

        (self.sink, dest_id) = self.parameterAsSink(parameters,
                self.PrmOutputLayer, context, fieldsout, wkbtype, srcCRS)

        self.htmlProcessor.processSource()
        self.htmlProcessor.addFeature.disconnect(self.addFeature)
        return {self.PrmOutputLayer: dest_id} 
开发者ID:NationalSecurityAgency,项目名称:qgis-kmltools-plugin,代码行数:38,代码来源:htmlExpansionDialog.py

示例15: getFlagFields

# 需要导入模块: from qgis.PyQt.QtCore import QVariant [as 别名]
# 或者: from qgis.PyQt.QtCore.QVariant import String [as 别名]
def getFlagFields(self):
        fields = QgsFields()
        fields.append(QgsField('reason',QVariant.String))
        return fields 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:6,代码来源:networkHandler.py


注:本文中的qgis.PyQt.QtCore.QVariant.String方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。