qgis

QCombo box to set layer (for Python QGIS plugin)

天涯浪子 提交于 2019-12-25 06:37:52
问题 I'm attempting to create a function to declare a variable in terms of an item chosen in a QComboBox. It's for a plugin for QGIS 2.0 and 2.2. I'm getting a "list index out of range" error, but cannot see why. I'm wondering if my combobox.currentIndex() isn't giving me what I think it is. If this is the case, I wonder if I should find a way set the combo box's index to something by default before the program runs. #connecting the combo boxes to function def initGui(self): QObject.connect(self

Piping Binary Data from Python GUI to c++ and back again

北城余情 提交于 2019-12-24 17:27:31
问题 I have been working on a project that pipes data back and forth between a QGIS plugin written in Python and some image processing code I have written in C++. After some community help via the following 2 questions I have gotten a console based sample code working that simulates an image, pipes it over to my C++ code, does some nontrivial processing, and then pipes it back and unpacks it correctly. I am having trouble porting this to a GUI style code. previous questions for reference: Data

postgres: client could not connect to server

此生再无相见时 提交于 2019-12-24 08:56:46
问题 For clarification, please note that I have found several similar questions on stackoverflow, but I could not fix my issue. psql: could not connect to server: Connection refused” Error when connecting to remote database psql: How to Allow Remote Access to PostgreSQL database I am trying to connect to a postgres DB installed in a remote server. To create a connection from the client I am using QGIS plugin (Add PostGIS Layer): The error that occurs is: could not connect to server: Connection

QGis总是无响应的原因之一

一曲冷凌霜 提交于 2019-12-24 02:33:14
QGis无响应的原因可能有多种,以下解决QGis无响应的方法是本人所遇到的,可能解决不了所有QGis无响应的情况,但是值得试一试,作为参考。 前几天安装QGis后是可以正常运行的,但在今天运行时总是无响应,只要是打开QGis后不管点击什么事件都会圆圈转个不停变成无响应,把QGis卸载后又重新装了一次还是出现同样的情况,后来想到了昨天安装了一个有道词典,把有道词典停止运行后再打开QGis就没有出现无响应了,就这样解决了。 PS:我怀疑是有道词典是一直跟踪鼠标事件,鼠标点击了就会查看点击的事件内容,这个功能与QGis冲突了。如果安装了类似的软件可以先让它停止运行后再打开QGis。 来源: CSDN 作者: 阿酷亚莫塔塔 链接: https://blog.csdn.net/qq_31793023/article/details/103671794

QGis二次开发,打开影像并在Qt控件中显示

半腔热情 提交于 2019-12-24 01:04:40
在这介绍的是通过QGis的二次开发,将影像打开后然后显示在Qt的控件中,我用的这个控件是QTabWidget。总体的思想是就是将QgsMapCanvas这个类的实例化对象添加到QTabWidget里面,显示QTabWidge的时候就会把QgsMapCanvas也显示出来,这就实现了通过Qt的控件来显示影像。 1.首先将QgsMapCanvas这个类的实例化对象添加到QTabWidget里面 //将影像界面放入TAB中 ui.tabWidget->addTab(&canvas, ""); //将TAB的高设为0 ui.tabWidget->tabBar()->setMaximumHeight(0); //信号与槽 connect(ui.act_tool_open, SIGNAL(triggered()), this, SLOT(act_tool_open_triggered())); 2.显示影像的槽函数 // 获取文件名称 QString filename = QFileDialog::getOpenFileName(this, "openFile", "E:/tif_sample/2013299"); if (filename.isEmpty()) {QMessageBox::critical(this, "警告", "文件名称为空"); return;} // 获取栅格图层

Installing the Python geojson module on Mac OS X Yosemite to use with QGIS

心不动则不痛 提交于 2019-12-22 00:27:12
问题 I am new to using QGIS so this question might be real easy but I just can't find the answer anywhere online. I need to use the module geojson in QGIS but it is not yet "installed". I've used import geojson and it says No module named geojson So my question is, how do I install geojson in QGIS or specifically PyQGIS? I've already downloaded geojson from a website called geojson-1.0.9. Which folder should I copy geojson into so that PyQGIS can find the geojson python module. Thanks! 回答1: I

postgis not available for all postgres users

余生颓废 提交于 2019-12-20 05:18:11
问题 When creating a new user on our Potgis enabled database I run into the strange issue that that new user cannot access the postgis extension while earlier created users can. With my user account I get the following output: mydb => SELECT postgis_version(); postgis_version --------------------------------------- 2.3 USE_GEOS=1 USE_PROJ=1 USE_STATS=1 (1 row) With the new user I get the following: mydb => SELECT postgis_version() mydb-> ; ERROR: function postgis_version() does not exist LINE 1:

How to invert KML so that area outside of polygon is highlighted

烈酒焚心 提交于 2019-12-12 21:42:26
问题 I have a KML File which is a polygon that overlays the boundaries of a city. Currently my polygon is shaded gray. I would like to invert it, so the rest of the world is greyed out, Here is a link to the kml, it should take you to Google maps. City of Edmonton I'm not really sure if this is something I need to change in my KML, or can be accomplished with the Google Maps API. 回答1: You need to change your KML. Add an outer boundary to the polygon that covers the whole world. Make sure the

Can python read the value of a cell in a spreadsheet?

╄→гoц情女王★ 提交于 2019-12-12 14:23:04
问题 All, Can python read the value of a cell in a spreadsheet? From a mapping/GIS/analysis standpoint: the simplest example would be a script that ran a buffer (proximity) tool on a given shapefile (GIS dataset). For the buffer distance parameter, instead of just using a number like '1000' feet, the script would point to a value in a cell of a spreadsheet (libre or open office preferred). If there was then a way to trigger the script from the spreadsheet by way of a button, that would be the next

python-qgis version information

若如初见. 提交于 2019-12-12 13:47:30
问题 Can someone tell me how I get the version information for python-qgis? I have tried all the usual foo.version or foo.__version__ or foo.VERSION . If someone knows how to do this, it would be a great help! 回答1: You can use qgis.utils.QGis.QGIS_VERSION: >>> import qgis.utils >>> qgis.utils.QGis.QGIS_VERSION '2.0.1-Dufour' 回答2: In QGIS3, this has changed to ( Qgis instead of QGis ) >>> import qgis.utils >>> qgis.utils.Qgis.QGIS_VERSION '3.1.0-Master' A way to figure out whether the version is >