[Qgis-developer] pyqgis

Ioan Ferencik ioan.ferencik at solargis.com
Wed Aug 31 00:30:37 PDT 2016


Hello There,
ia'd like to know how can I get programatically
in pyqgis all project properties stored inside the properties section of a
project file

I know i can read them using QDomDocument or lxml but I want to retrieve
them from the QgsProject object




<properties>
    <Variables>
      <variableNames type="QStringList"/>
      <variableValues type="QStringList"/>
    </Variables>
    <WMSContactPerson type="QString"></WMSContactPerson>
    <WMSOnlineResource type="QString"></WMSOnlineResource>
    <WMSUseLayerIDs type="bool">false</WMSUseLayerIDs>
    <WMSContactOrganization type="QString"></WMSContactOrganization>
    <WMSKeywordList type="QStringList">
      <value></value>
    </WMSKeywordList>
    <WFSUrl type="QString"></WFSUrl>
    <Paths>
      <Absolute type="bool">false</Absolute>
    </Paths>
    <WMSServiceTitle type="QString"></WMSServiceTitle>
    <WFSLayers type="QStringList"/>
    <WMSRestrictedLayers type="QStringList"/>
    <WMSContactMail type="QString"></WMSContactMail>
    <WMSRestrictedComposers type="QStringList"/>
    <PositionPrecision>
      <DecimalPlaces type="int">2</DecimalPlaces>
      <Automatic type="bool">true</Automatic>
      <DegreeFormat type="QString">MU</DegreeFormat>
    </PositionPrecision>
    <WCSUrl type="QString"></WCSUrl>
    <WMSContactPhone type="QString"></WMSContactPhone>
    <WMSServiceCapabilities type="bool">false</WMSServiceCapabilities>
    <WMSServiceAbstract type="QString"></WMSServiceAbstract>
    <WMSContactPosition type="QString"></WMSContactPosition>
    <WMSAddWktGeometry type="bool">false</WMSAddWktGeometry>
    <Measure>
      <Ellipsoid type="QString">WGS84</Ellipsoid>
    </Measure>
    <WMSPrecision type="QString">8</WMSPrecision>
    <WFSTLayers>
      <Insert type="QStringList"/>
      <Update type="QStringList"/>
      <Delete type="QStringList"/>
    </WFSTLayers>
    <Gui>
      <SelectionColorBluePart type="int">0</SelectionColorBluePart>
      <CanvasColorGreenPart type="int">255</CanvasColorGreenPart>
      <CanvasColorRedPart type="int">255</CanvasColorRedPart>
      <SelectionColorRedPart type="int">255</SelectionColorRedPart>
      <SelectionColorAlphaPart type="int">255</SelectionColorAlphaPart>
      <SelectionColorGreenPart type="int">255</SelectionColorGreenPart>
      <CanvasColorBluePart type="int">255</CanvasColorBluePart>
    </Gui>
    <Digitizing>
      <DefaultSnapToleranceUnit type="int">2</DefaultSnapToleranceUnit>
      <SnappingMode type="QString">current_layer</SnappingMode>
      <DefaultSnapType type="QString">off</DefaultSnapType>
      <DefaultSnapTolerance type="double">0</DefaultSnapTolerance>
    </Digitizing>
    <Identify>
      <disabledLayers type="QStringList"/>
    </Identify>
    <Macros>
      <pythonCode type="QString"></pythonCode>
    </Macros>
    <WMSAccessConstraints type="QString">None</WMSAccessConstraints>
    <WCSLayers type="QStringList"/>
    <Legend>
      <filterByMap type="bool">false</filterByMap>
    </Legend>
    <SpatialRefSys>
      <ProjectCRSProj4String type="QString">+proj=merc +lon_0=0 +k=1 +x_0=0
+y_0=0 +datum=WGS84 +units=m +no_defs</ProjectCRSProj4String>
      <ProjectCrs type="QString">EPSG:3395</ProjectCrs>
      <ProjectCRSID type="int">1353</ProjectCRSID>
      <ProjectionsEnabled type="int">1</ProjectionsEnabled>
    </SpatialRefSys>
    <DefaultStyles>
      <Fill type="QString"></Fill>
      <Line type="QString"></Line>
      <Marker type="QString"></Marker>
      <RandomColors type="bool">true</RandomColors>
      <AlphaInt type="int">255</AlphaInt>
      <ColorRamp type="QString"></ColorRamp>
    </DefaultStyles>
    <WMSFees type="QString">conditions unknown</WMSFees>
    <WMSImageQuality type="int">90</WMSImageQuality>
    <Measurement>
      <DistanceUnits type="QString">meters</DistanceUnits>
      <AreaUnits type="QString">m2</AreaUnits>
    </Measurement>
    <WMSUrl type="QString"></WMSUrl>
  </properties>
  <visibility-presets/>


Thanks in advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20160831/9736aa54/attachment.html>


More information about the Qgis-developer mailing list