Thursday, 29 November 2018

QGIS Python script for creating project file


Is there a way to create QGIS project file(.qgs) using only Python script outside QGIS Python console. I am trying to publish a map using QGIS Web Client using python.


For this, I am trying to do below



  1. Create .qgs file dynamically

  2. Add Legend and Layers to the .qgs file and save

  3. Set WFS,WCS parameters in the .qgs file


Finally use this file to view QGIS web client.



I tried to tweak the tool available at https://github.com/oware/Mxd2Qgs. I am successful to certain extent, i.e. creating a .qgs file. But I need some inputs on Getting layer (vector/raster) properties when path for the files is given.



# Import system modules
from xml.dom.minidom import Document
import string
import os
import glob


#Read input parameters from GP dialog

output = "myworld.qgs"

#Create an output qgs file
f = open(output, "w")

# Create the minidom
doc = Document()

# Create the base element
qgis = doc.createElement("qgis")

qgis.setAttribute("projectname", " ")
qgis.setAttribute("version", "2.4.0-Chugiak")
doc.appendChild(qgis)

# Create the element<br/>title = doc.createElement("title")<br/>qgis.appendChild(title)<br/><br/><br/>unit = doc.createTextNode("degrees")<br/><br/>xmin1 = doc.createTextNode(str("-180"))<br/>ymin1 = doc.createTextNode(str("-90"))<br/>xmax1 = doc.createTextNode(str("180"))<br/>ymax1 = doc.createTextNode(str("90"))<br/>proj4id = doc.createTextNode(str("+proj=longlat +datum=WGS84 +no_defs"))<br/>srid1 = doc.createTextNode(str("4326"))<br/>srid2 = doc.createTextNode(str("3452"))<br/>epsg1 = doc.createTextNode(str("4326"))<br/>epsg2 = doc.createTextNode(str("4326"))<br/>description1 = doc.createTextNode(str("WGS 84"))<br/><br/>description2 = doc.createTextNode(str("WGS 84"))<br/>ellipsoidacronym1 = doc.createTextNode(str("WGS84"))<br/>ellipsoidacronym2 = doc.createTextNode(str("WGS84"))<br/>geographicflag1 = doc.createTextNode("true")<br/>geographicflag2 = doc.createTextNode("true")<br/>pa=doc.createTextNode("longlat")<br/>authid2 = doc.createTextNode("EPSG:"+str("4326"))<br/>authid3 = doc.createTextNode("EPSG:"+str("4326"))<br/>count2=0<br/># mapcanvas<br/><br/>def map_canvas():<br/> # Create the <mapcanvas> element<br/> mapcanvas = doc.createElement("mapcanvas")<br/> qgis.appendChild(mapcanvas)<br/><br/># Create the <units> element<br/>units = doc.createElement("units")<br/>units.appendChild(unit)<br/>mapcanvas.appendChild(units)<br/><br/><br/># Create the <extent> element<br/>extent = doc.createElement("extent")<br/>mapcanvas.appendChild(extent)<br/><br/># Create the <xmin> element<br/>xmin = doc.createElement("xmin")<br/>xmin.appendChild(xmin1)<br/>extent.appendChild(xmin)<br/><br/># Create the <ymin> element<br/><br/>ymin = doc.createElement("ymin")<br/>ymin.appendChild(ymin1)<br/>extent.appendChild(ymin)<br/><br/># Create the <xmax> element<br/>xmax = doc.createElement("xmax")<br/>xmax.appendChild(xmax1)<br/>extent.appendChild(xmax)<br/><br/># Create the <ymax> element<br/><br/>ymax = doc.createElement("ymax")<br/>ymax.appendChild(ymax1)<br/>extent.appendChild(ymax)<br/><br/># Create the <projections> element<br/>projections = doc.createElement("projections")<br/>mapcanvas.appendChild(projections)<br/><br/># Create the <destinationsrs> element<br/>destinationsrs = doc.createElement("destinationsrs")<br/><br/>mapcanvas.appendChild(destinationsrs)<br/><br/># Create the <spatialrefsys> element<br/>spatialrefsys = doc.createElement("spatialrefsys")<br/>destinationsrs.appendChild(spatialrefsys)<br/><br/># Create the <proj4> element<br/>proj4 = doc.createElement("proj4")<br/>proj4.appendChild(proj4id)<br/>spatialrefsys.appendChild(proj4)<br/><br/><br/># Create the <srsid> element<br/>srsid = doc.createElement("srsid")<br/>srsid.appendChild(srid2)<br/>spatialrefsys.appendChild(srsid)<br/><br/># Create the <srid> element<br/>srid = doc.createElement("srid")<br/>srid.appendChild(srid1)<br/>spatialrefsys.appendChild(srid)<br/><br/><br/># Create the <authid> element<br/>authid = doc.createElement("authid")<br/>authid.appendChild(authid2)<br/>spatialrefsys.appendChild(authid)<br/><br/># Create the <description> element<br/>description = doc.createElement("description")<br/>description.appendChild(description1)<br/>spatialrefsys.appendChild(description)<br/><br/><br/># Create the <projectionacronym> element<br/>projectionacronym = doc.createElement("projectionacronym")<br/>spatialrefsys.appendChild(projectionacronym)<br/>projectionacronym.appendChild(pa)<br/><br/># Create the <ellipsoidacronym element<br/>ellipsoidacronym = doc.createElement("ellipsoidacronym")<br/>ellipsoidacronym.appendChild(ellipsoidacronym1)<br/>spatialrefsys.appendChild(ellipsoidacronym)<br/><br/><br/># Create the <geographicflag> element<br/>geographicflag = doc.createElement("geographicflag")<br/>geographicflag.appendChild(geographicflag1)<br/>spatialrefsys.appendChild(geographicflag)<br/><br/><br/><br/># Legend<br/># Legend<br/><br/>def legend_func():<br/> global count2<br/> # Create the <legend> element<br/> legend = doc.createElement("legend")<br/> qgis.appendChild(legend)<br/><br/><br/>for lyr in os.listdir(r"C:\Build\xyz\shapefiles"):<br/> if lyr.endswith('.shp'):<br/> count2=count2+1 <br/><br/> print lyr<br/> print "\n"<br/> # Create the <legendlayer> element<br/> legendlayer = doc.createElement("legendlayer")<br/> legendlayer.setAttribute("open", "true")<br/> legendlayer.setAttribute("checked", "Qt::Checked")<br/> legendlayer.setAttribute("name",lyr)<br/><br/> legend.appendChild(legendlayer)<br/><br/><br/> # Create the <filegroup> element<br/> filegroup = doc.createElement("filegroup")<br/> filegroup.setAttribute("open", "true")<br/> filegroup.setAttribute("hidden", "false")<br/> legendlayer.appendChild(filegroup)<br/><br/> # Create the <legendlayerfile> element<br/> legendlayerfile = doc.createElement("legendlayerfile")<br/> legendlayerfile.setAttribute("isInOverview", "0")<br/> legendlayerfile.setAttribute("layerid", lyr+str(20110427170816078))<br/><br/> legendlayerfile.setAttribute("visible", "1")<br/> filegroup.appendChild(legendlayerfile)<br/><br/><br/># Project Layers<br/>def project_layers(): <br/> # Create the <projectlayers> element<br/> projectlayers = doc.createElement("projectlayers")<br/> count1=str(count2)<br/> projectlayers.setAttribute("layercount", count1)<br/><br/> qgis.appendChild(projectlayers)<br/><br/>for lyr in os.listdir(r"C:\Build\xyz\shapefiles"):<br/><br/> if lyr.endswith('.shp'):<br/><br/> print lyr<br/> print "\n"<br/> ds = doc.createTextNode(str(r"C:\Build\xyz\shapefiles"+"\\"+lyr))<br/> #Tool fails here as there is dependency on ArcGIS<br/><br/> #Is there a way to replace below 2 lines ,with equivalents from QGIS?<br/> geometry1 = arcpy.Describe(lyr)<br/> geometry2 = str(geometry1.shapeType)<br/><br/> name1 = doc.createTextNode(lyr+str(20110427170816078))<br/> name2 = doc.createTextNode(lyr)<br/><br/> # Create the <maplayer> element<br/> maplayer = doc.createElement("maplayer")<br/> maplayer.setAttribute("minimumScale", "0")<br/><br/> maplayer.setAttribute("maximumScale", "1e+08")<br/> maplayer.setAttribute("minLabelScale", "0")<br/> maplayer.setAttribute("maxLabelScale", "1e+08")<br/> maplayer.setAttribute("geometry", geometry2)<br/> maplayer.setAttribute("type", "vector")<br/> maplayer.setAttribute("hasScaleBasedVisibilityFlag", "0")<br/> maplayer.setAttribute("scaleBasedLabelVisibilityFlag", "0")<br/> projectlayers.appendChild(maplayer)<br/><br/> # Create the <id> element<br/><br/> id = doc.createElement("id")<br/> id.appendChild(name1)<br/> maplayer.appendChild(id)<br/><br/> # Create the <datasource> element<br/> datasource = doc.createElement("datasource")<br/> datasource.appendChild(ds)<br/> maplayer.appendChild(datasource)<br/><br/> # Create the <layername> element<br/><br/> layername = doc.createElement("layername")<br/> layername.appendChild(name2)<br/> maplayer.appendChild(layername)<br/><br/> # Create the <srs> element<br/> srs = doc.createElement("srs")<br/> maplayer.appendChild(srs)<br/><br/> # Create the <spatialrefsys> element<br/> spatialrefsys = doc.createElement("spatialrefsys")<br/><br/> srs.appendChild(spatialrefsys)<br/><br/> # Create the <proj4> element<br/> proj4 = doc.createElement("proj4")<br/> spatialrefsys.appendChild(proj4)<br/><br/> # Create the <srsid> element<br/> srsid = doc.createElement("srsid")<br/> spatialrefsys.appendChild(srsid)<br/><br/><br/> # Create the <srid> element<br/> srid = doc.createElement("srid")<br/> srid.appendChild(srid2)<br/> spatialrefsys.appendChild(srid)<br/><br/><br/> # Create the <authid> element<br/> authid = doc.createElement("authid")<br/> authid.appendChild(authid3)<br/> spatialrefsys.appendChild(authid)<br/><br/><br/><br/> # Create the <description> element<br/> description = doc.createElement("description")<br/> description.appendChild(description2)<br/> spatialrefsys.appendChild(description)<br/><br/><br/> # Create the <projectionacronym> element<br/> projectionacronym = doc.createElement("projectionacronym")<br/><br/> spatialrefsys.appendChild(projectionacronym)<br/><br/> # Create the <ellipsoidacronym element<br/> ellipsoidacronym = doc.createElement("ellipsoidacronym")<br/> ellipsoidacronym.appendChild(ellipsoidacronym2)<br/> spatialrefsys.appendChild(ellipsoidacronym)<br/><br/><br/> # Create the <geographicflag> element<br/> geographicflag = doc.createElement("geographicflag")<br/><br/> geographicflag.appendChild(geographicflag2)<br/> spatialrefsys.appendChild(geographicflag)<br/><br/> # Create the <transparencyLevelInt> element<br/> transparencyLevelInt = doc.createElement("transparencyLevelInt")<br/> transparency2 = doc.createTextNode("255")<br/> transparencyLevelInt.appendChild(transparency2)<br/> maplayer.appendChild(transparencyLevelInt)<br/><br/> # Create the <customproperties> element<br/><br/> customproperties = doc.createElement("customproperties")<br/> maplayer.appendChild(customproperties)<br/><br/> # Create the <provider> element<br/> provider = doc.createElement("provider")<br/> provider.setAttribute("encoding", "System")<br/> ogr = doc.createTextNode("ogr")<br/> provider.appendChild(ogr)<br/> maplayer.appendChild(provider)<br/><br/><br/> # Create the <singlesymbol> element<br/> singlesymbol = doc.createElement("singlesymbol")<br/> maplayer.appendChild(singlesymbol)<br/><br/> # Create the <symbol> element<br/> symbol = doc.createElement("symbol")<br/> singlesymbol.appendChild(symbol)<br/><br/> # Create the <lowervalue> element<br/> lowervalue = doc.createElement("lowervalue")<br/><br/> symbol.appendChild(lowervalue)<br/><br/> # Create the <uppervalue> element<br/> uppervalue = doc.createElement("uppervalue")<br/> symbol.appendChild(uppervalue)<br/><br/> # Create the <label> element<br/> label = doc.createElement("label")<br/> symbol.appendChild(label)<br/><br/><br/> # Create the <rotationclassificationfieldname> element<br/> rotationclassificationfieldname = doc.createElement("rotationclassificationfieldname")<br/> symbol.appendChild(rotationclassificationfieldname)<br/><br/> # Create the <scaleclassificationfieldname> element<br/> scaleclassificationfieldname = doc.createElement("scaleclassificationfieldname")<br/> symbol.appendChild(scaleclassificationfieldname)<br/><br/> # Create the <symbolfieldname> element<br/> symbolfieldname = doc.createElement("symbolfieldname")<br/><br/> symbol.appendChild(symbolfieldname)<br/><br/> # Create the <outlinecolor> element<br/> outlinecolor = doc.createElement("outlinecolor")<br/> outlinecolor.setAttribute("red", "88")<br/> outlinecolor.setAttribute("blue", "99")<br/> outlinecolor.setAttribute("green", "37")<br/> symbol.appendChild(outlinecolor)<br/><br/> # Create the <outlinestyle> element<br/><br/> outlinestyle = doc.createElement("outlinestyle")<br/> outline = doc.createTextNode("SolidLine")<br/> outlinestyle.appendChild(outline)<br/> symbol.appendChild(outlinestyle)<br/><br/> # Create the <outlinewidth> element<br/> outlinewidth = doc.createElement("outlinewidth")<br/> width = doc.createTextNode("0.26")<br/> outlinewidth.appendChild(width)<br/> symbol.appendChild(outlinewidth)<br/><br/><br/> # Create the <fillcolor> element<br/> fillcolor = doc.createElement("fillcolor")<br/> fillcolor.setAttribute("red", "90")<br/> fillcolor.setAttribute("blue", "210")<br/> fillcolor.setAttribute("green", "229")<br/> symbol.appendChild(fillcolor)<br/><br/> # Create the <fillpattern> element<br/> fillpattern = doc.createElement("fillpattern")<br/><br/> fill = doc.createTextNode("SolidPattern")<br/> fillpattern.appendChild(fill)<br/> symbol.appendChild(fillpattern)<br/><br/> # Create the <texturepath> element<br/> texturepath = doc.createElement("texturepath")<br/> texturepath.setAttribute("null", "1")<br/> symbol.appendChild(texturepath)<br/><br/><br/><br/><br/>map_canvas()<br/>legend_func()<br/>project_layers()<br/><br/><br/># Write to qgis file<br/><br/>try:<br/> f.write(doc.toprettyxml())<br/><br/>finally:<br/> f.close()<br/><br/>print 'Done'<br/></code></pre></div><br/><div class="post-text" itemprop="text"> <div style="font-weight: bold;"><p class="normal">Answer</p> <br/></div><br/><p>Struggled a bit for last 2 days. Abandoned XML approach. Able to accomplish first 2 tasks.</p><br/><p>Need to check how I can accomplish setting WFS,WCS parameters</p><br/><ol><br/><li>Create <code>.qgs</code> file dynamically</li><br/><li>Add Legend and Layers to the <code>.qgs</code> file and save</li><br/><br/><li>Set WFS,WCS parameters in the <code>.qgs</code> file</li><br/></ol><br/><br/><pre><code>from xml.dom.minidom import Document<br/>import string<br/>import os<br/>import sys<br/>from qgis.core import *<br/>from qgis.gui import *<br/>from PyQt4.QtCore import *<br/><br/>from PyQt4.QtGui import QApplication<br/>from PyQt4.QtXml import *<br/><br/><br/>#Read input parameters from GP dialog<br/>strProjetName = "C:/OSGeo4W/apache/htdocs/QGIS-Web-Client-master/projects/myworld.qgs"<br/><br/> if os.path.isfile(strProjetName):<br/> os.remove(strProjetName)<br/><br/><br/> def add_Layers():<br/> QGISAPP = QgsApplication(sys.argv, True) <br/> QgsApplication.setPrefixPath(r"C:\OSGeo4W\apps\qgis", True)<br/> QgsApplication.initQgis() <br/> QgsProject.instance().setFileName(strProjetName)<br/> print QgsProject.instance().fileName()<br/><br/><br/>for file1 in os.listdir(r"C:\myprojects\world"):<br/> if file1.endswith('.shp'):<br/><br/> layer = QgsVectorLayer(r"C:\myprojects\world"+r"\\"+file1, file1, "ogr")<br/> print file1<br/> print layer.isValid()<br/> # Add layer to the registry<br/> QgsMapLayerRegistry.instance().addMapLayer(layer)<br/><br/><br/>QgsProject.instance().write()<br/>QgsApplication.exitQgis()<br/><br/><br/>add_Layers()<br/></code></pre></div> <div style='clear: both;'></div> </div> <div class='post-footer'> <div class='post-footer-line post-footer-line-1'> <span class='post-author vcard'> </span> <span class='post-timestamp'> - <meta content='https://gisqas.blogspot.com/2018/11/qgis-python-script-for-creating-project.html' itemprop='url'/> <a class='timestamp-link' href='https://gisqas.blogspot.com/2018/11/qgis-python-script-for-creating-project.html?m=1' rel='bookmark' title='permanent link'><abbr class='published' itemprop='datePublished' title='2018-11-29T17:45:00-08:00'>November 29, 2018</abbr></a> </span> <span class='post-comment-link'> </span> </div> <div class='post-footer-line post-footer-line-2'> <div class='mobile-link-button goog-inline-block' id='mobile-share-button'> <a href='javascript:void(0);'>Share</a> </div> </div> </div> </div> <div class='comments' id='comments'> <a name='comments'></a> <h4>No comments:</h4> <div id='Blog1_comments-block-wrapper'> <dl class='avatar-comment-indent' id='comments-block'> </dl> </div> <p class='comment-footer'> <div class='comment-form'> <a name='comment-form'></a> <h4 id='comment-post-message'> <a href='javascript:void(0)' id='Blog1_comment-editor-toggle-link'>Post a Comment</a></h4> <p> </p> <a href='https://www.blogger.com/comment/frame/6220276627345324806?po=7733141262871347704&hl=en-GB&saa=85391&origin=https://gisqas.blogspot.com&m=1' id='comment-editor-src'></a> <iframe allowtransparency='true' class='blogger-iframe-colorize blogger-comment-from-post' frameborder='0' height='410px' id='comment-editor' name='comment-editor' src='' style='display: none' width='100%'></iframe> <script src='https://www.blogger.com/static/v1/jsbin/1345082660-comment_from_post_iframe.js' type='text/javascript'></script> <script type='text/javascript'> BLOG_CMT_createIframe('https://www.blogger.com/rpc_relay.html'); </script> </div> </p> </div> </div> </div> </div> </div> <div class='blog-pager' id='blog-pager'> <div class='mobile-link-button' id='blog-pager-newer-link'> <a class='blog-pager-newer-link' href='https://gisqas.blogspot.com/2018/11/arcmap-creating-relationship-database.html?m=1' id='Blog1_blog-pager-newer-link' title='Newer Post'>‹</a> </div> <div class='mobile-link-button' id='blog-pager-older-link'> <a class='blog-pager-older-link' href='https://gisqas.blogspot.com/2018/11/arcgis-10-geotiff-export.html?m=1' id='Blog1_blog-pager-older-link' title='Older Post'>›</a> </div> <div class='mobile-link-button' id='blog-pager-home-link'> <a class='home-link' href='https://gisqas.blogspot.com/?m=1'>Home</a> </div> <div class='mobile-desktop-link'> <a class='home-link' href='https://gisqas.blogspot.com/2018/11/qgis-python-script-for-creating-project.html?m=0'>View web version</a> </div> </div> <div class='clear'></div> </div> </div> </div> </div> <div class='column-left-outer'> <div class='column-left-inner'> <aside> </aside> </div> </div> <div class='column-right-outer'> <div class='column-right-inner'> <aside> </aside> </div> </div> </div> <div style='clear: both'></div> <!-- columns --> </div> <!-- main --> </div> </div> <div class='main-cap-bottom cap-bottom'> <div class='cap-left'></div> <div class='cap-right'></div> </div> </div> <footer> <div class='footer-outer'> <div class='footer-cap-top cap-top'> <div class='cap-left'></div> <div class='cap-right'></div> </div> <div class='fauxborder-left footer-fauxborder-left'> <div class='fauxborder-right footer-fauxborder-right'></div> <div class='region-inner footer-inner'> <div class='foot section' id='footer-1'> </div> <!-- outside of the include in order to lock Attribution widget --> <div class='foot section' id='footer-3' name='Footer'><div class='widget Attribution' data-version='1' id='Attribution1'> <div class='widget-content' style='text-align: center;'> Powered by <a href='https://www.blogger.com' target='_blank'>Blogger</a>. </div> <div class='clear'></div> </div></div> </div> </div> <div class='footer-cap-bottom cap-bottom'> <div class='cap-left'></div> <div class='cap-right'></div> </div> </div> </footer> <!-- content --> </div> </div> <div class='content-cap-bottom cap-bottom'> <div class='cap-left'></div> <div class='cap-right'></div> </div> </div> </div> <script type='text/javascript'> window.setTimeout(function() { document.body.className = document.body.className.replace('loading', ''); }, 10); </script> <script type="text/javascript" src="https://www.blogger.com/static/v1/widgets/382300504-widgets.js"></script> <script type='text/javascript'> var BLOG_BASE_IMAGE_URL = 'https://resources.blogblog.com/img';var BLOG_LANG_DIR = 'ltr';window['__wavt'] = 'AOuZoY4W3IM_02vRSEDdO6bUUS3IhuwRjQ:1765866612104';_WidgetManager._Init('//www.blogger.com/rearrange?blogID\x3d6220276627345324806','//gisqas.blogspot.com/2018/11/qgis-python-script-for-creating-project.html?m\x3d1','6220276627345324806'); _WidgetManager._SetDataContext([{'name': 'blog', 'data': {'blogId': '6220276627345324806', 'title': 'Blog', 'url': 'https://gisqas.blogspot.com/2018/11/qgis-python-script-for-creating-project.html?m\x3d1', 'canonicalUrl': 'https://gisqas.blogspot.com/2018/11/qgis-python-script-for-creating-project.html', 'homepageUrl': 'https://gisqas.blogspot.com/?m\x3d1', 'searchUrl': 'https://gisqas.blogspot.com/search', 'canonicalHomepageUrl': 'https://gisqas.blogspot.com/', 'blogspotFaviconUrl': 'https://gisqas.blogspot.com/favicon.ico', 'bloggerUrl': 'https://www.blogger.com', 'hasCustomDomain': false, 'httpsEnabled': true, 'enabledCommentProfileImages': true, 'gPlusViewType': 'FILTERED_POSTMOD', 'adultContent': false, 'analyticsAccountNumber': '', 'encoding': 'UTF-8', 'locale': 'en-GB', 'localeUnderscoreDelimited': 'en_gb', 'languageDirection': 'ltr', 'isPrivate': false, 'isMobile': true, 'isMobileRequest': true, 'mobileClass': ' mobile', 'isPrivateBlog': false, 'isDynamicViewsAvailable': true, 'feedLinks': '\x3clink rel\x3d\x22alternate\x22 type\x3d\x22application/atom+xml\x22 title\x3d\x22Blog - Atom\x22 href\x3d\x22https://gisqas.blogspot.com/feeds/posts/default\x22 /\x3e\n\x3clink rel\x3d\x22alternate\x22 type\x3d\x22application/rss+xml\x22 title\x3d\x22Blog - RSS\x22 href\x3d\x22https://gisqas.blogspot.com/feeds/posts/default?alt\x3drss\x22 /\x3e\n\x3clink rel\x3d\x22service.post\x22 type\x3d\x22application/atom+xml\x22 title\x3d\x22Blog - Atom\x22 href\x3d\x22https://www.blogger.com/feeds/6220276627345324806/posts/default\x22 /\x3e\n\n\x3clink rel\x3d\x22alternate\x22 type\x3d\x22application/atom+xml\x22 title\x3d\x22Blog - Atom\x22 href\x3d\x22https://gisqas.blogspot.com/feeds/7733141262871347704/comments/default\x22 /\x3e\n', 'meTag': '', 'adsenseHostId': 'ca-host-pub-1556223355139109', 'adsenseHasAds': true, 'adsenseAutoAds': false, 'boqCommentIframeForm': true, 'loginRedirectParam': '', 'isGoogleEverywhereLinkTooltipEnabled': true, 'view': '', 'dynamicViewsCommentsSrc': '//www.blogblog.com/dynamicviews/4224c15c4e7c9321/js/comments.js', 'dynamicViewsScriptSrc': '//www.blogblog.com/dynamicviews/91113183d353c15a', 'plusOneApiSrc': 'https://apis.google.com/js/platform.js', 'disableGComments': true, 'interstitialAccepted': false, 'sharing': {'platforms': [{'name': 'Get link', 'key': 'link', 'shareMessage': 'Get link', 'target': ''}, {'name': 'Facebook', 'key': 'facebook', 'shareMessage': 'Share to Facebook', 'target': 'facebook'}, {'name': 'BlogThis!', 'key': 'blogThis', 'shareMessage': 'BlogThis!', 'target': 'blog'}, {'name': 'X', 'key': 'twitter', 'shareMessage': 'Share to X', 'target': 'twitter'}, {'name': 'Pinterest', 'key': 'pinterest', 'shareMessage': 'Share to Pinterest', 'target': 'pinterest'}, {'name': 'Email', 'key': 'email', 'shareMessage': 'Email', 'target': 'email'}], 'disableGooglePlus': true, 'googlePlusShareButtonWidth': 0, 'googlePlusBootstrap': '\x3cscript type\x3d\x22text/javascript\x22\x3ewindow.___gcfg \x3d {\x27lang\x27: \x27en_GB\x27};\x3c/script\x3e'}, 'hasCustomJumpLinkMessage': false, 'jumpLinkMessage': 'Read more', 'pageType': 'item', 'postId': '7733141262871347704', 'pageName': 'QGIS Python script for creating project file', 'pageTitle': 'Blog: QGIS Python script for creating project file'}}, {'name': 'features', 'data': {}}, {'name': 'messages', 'data': {'edit': 'Edit', 'linkCopiedToClipboard': 'Link copied to clipboard', 'ok': 'Ok', 'postLink': 'Post link'}}, {'name': 'template', 'data': {'name': 'custom', 'localizedName': 'Custom', 'isResponsive': false, 'isAlternateRendering': true, 'isCustom': true}}, {'name': 'view', 'data': {'classic': {'name': 'classic', 'url': '?view\x3dclassic'}, 'flipcard': {'name': 'flipcard', 'url': '?view\x3dflipcard'}, 'magazine': {'name': 'magazine', 'url': '?view\x3dmagazine'}, 'mosaic': {'name': 'mosaic', 'url': '?view\x3dmosaic'}, 'sidebar': {'name': 'sidebar', 'url': '?view\x3dsidebar'}, 'snapshot': {'name': 'snapshot', 'url': '?view\x3dsnapshot'}, 'timeslide': {'name': 'timeslide', 'url': '?view\x3dtimeslide'}, 'isMobile': true, 'title': 'QGIS Python script for creating project file', 'description': 'Is there a way to create QGIS project file( .qgs ) using only Python script outside QGIS Python console. I am trying to publish a map using ...', 'url': 'https://gisqas.blogspot.com/2018/11/qgis-python-script-for-creating-project.html?m\x3d1', 'type': 'item', 'isSingleItem': true, 'isMultipleItems': false, 'isError': false, 'isPage': false, 'isPost': true, 'isHomepage': false, 'isArchive': false, 'isLabelSearch': false, 'postId': 7733141262871347704}}]); _WidgetManager._RegisterWidget('_HeaderView', new _WidgetInfo('Header1', 'header', document.getElementById('Header1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_BlogView', new _WidgetInfo('Blog1', 'main', document.getElementById('Blog1'), {'cmtInteractionsEnabled': false, 'mobile': true}, 'displayModeFull')); _WidgetManager._RegisterWidget('_FeaturedPostView', new _WidgetInfo('FeaturedPost1', 'main', document.getElementById('FeaturedPost1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_PopularPostsView', new _WidgetInfo('PopularPosts1', 'main', document.getElementById('PopularPosts1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_BlogSearchView', new _WidgetInfo('BlogSearch1', 'sidebar-right-1', document.getElementById('BlogSearch1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_BlogArchiveView', new _WidgetInfo('BlogArchive1', 'sidebar-right-1', document.getElementById('BlogArchive1'), {'languageDirection': 'ltr', 'loadingMessage': 'Loading\x26hellip;'}, 'displayModeFull')); _WidgetManager._RegisterWidget('_AttributionView', new _WidgetInfo('Attribution1', 'footer-3', document.getElementById('Attribution1'), {}, 'displayModeFull')); </script> </body> </html>