Tag Info

Hot answers tagged

7

You can use the QGIS Browser for your version of QGIS which (as it says) mainly allows you to browse through your shapefiles by accessing their Metadata and attributes. As it is a browser, it won't load the analytical tools or plugins. It also provides a preview for displaying: Hope this helps!


5

Use the ogr2ogr command line tool, that is distributed with QGIS. In Windows, open the OSGeo4W Shell from the QGIS program group and enter for %p in (path_to_gpx_files\*ride*.gpx) do ogr2ogr path_for_output\gpx.shp -append %p track_points -fieldTypeToString DateTime The equivalent command in a Unix bash shell would be for i in $( ls ...


4

Try in your script: from qgis.utils import iface #your code here iface.actionExit().trigger() It works for me. Editing Note: Based in Conley Owens'comment, I changed slightly my script to do "something useful" (where the line that import iface was commented). #from qgis.utils import iface import os os.system('clear') print "Hello" ...


3

If you want to reproject data from one CRS to another, DO NOT simply change the CRS with Set CRS for Layer. This will NOT reproject any coordinates. So please change the CRS back to EPSG:4326 since that is the correct CRS for your lat/lon data. Instead, use Save As... to another file name and CRS. You might want to use ESRI Shapefile format, since CSV does ...


3

Although you're asking for an answer related to value map combo-boxes, I thought to provide an alternative where you could use the following code to read the values in the first row for each column and copy it for each of the attributes. Select the layer in QGIS and copy/paste the code into the Python Console (Plugins > Python Console or Ctrl + Alt + P): ...


3

Fixed. The problem was is no primary key. In pgAdmin do this request. ALTER TABLE tableName ADD PRIMARY KEY (id); Example for planet_osm_line table and setting osm_id column ,as primary key : ALTER TABLE planet_osm_line ADD PRIMARY KEY (osm_id); untill osm_id is unique.


3

The problem has a few days ago been solved in QGIS master. I have prepared a patch for QGIS 2.10 but I hope that the QGIS developers will backport it. Since only Python changes are involved, an existing installation can now be easily fixed without having to reinstall everything.


3

I rewrote my answer from a parallel question counting points in current atlas feature: How to count points within the current Print composer atlas feature in QGIS 2.8? Build a new function in the expression editor: from qgis.core import * from qgis.gui import * from qgis.utils import iface @qgsfunction(args="auto", group='Custom') def ...


3

Set lon_0 to the middle of your study area. k can be set to 0.9996 (as UTM has). lat_0, x_0 and y_0 have no effect on the quality of the projection. They are usually set to the equator and/or the inverse of the lower left point so that all coordinates are positive.


2

Three other possibilities: Project/Save as image, you'll get a georeferenced image of canvas (limited/screen resolution) In Print composer Composer/Export as image, you will get az image of the set page size, no georeference From the command line use --snapshot switch, huge image can be created with georeference (qgis exit after creating the image, can be ...


2

This could be the solution to your issue. My line dataset had lines dissolved by an attribute, so that two (or more) lines in separate locations were merged (the dissolve command has an option for this or the merge command may have been used) to a single record of the attribute table. When editing the vertices of such a record you can see ...


2

This should be all you need: feats = self.layer.getFeatures() self.layer.startEditing() for feat in feats: score = scores[i] feat['F_SCORE'] = score layer.updateFeature(feat) self.layer.commitChanges() You are mixing update via the layer vs at the provider. Generally you should only update via the layer as it provides rollback and error ...


2

There seems to be some inconsitency about the datum shift parameters for EPSG:5221. Using gdalsrsinfo epsg:5221, GDAL 1.11.2 reports: +proj=krovak +lat_0=49.5 +lon_0=42.5 +alpha=30.28813972222222 +k=0.9999 +x_0=0 +y_0=0 +ellps=bessel +towgs84=589,76,480,0,0,0,0 +pm=ferro +units=m +no_defs Whereas the current QGIS 2.8.2 has this definition: +proj=krovak ...


2

Not sure if there's another way, but this is how I've implemented it. You need these three functions (make sure you import the required QGIS and Qt4 classes before): def createMapTips( self ): """ Create MapTips on the map """ self.timerMapTips = QTimer( self.canvas ) self.mapTip = QgsMapTip() self.connect( self.canvas, SIGNAL( ...


2

Probably what you want is an autosave function. There is an autoSaver plugin that you can install, that provides a basic autosave function for the current project and modified layers in edit mode, running at a specified interval. You can also specify to autosave into an alternate backup file. You can find the plugin in the QGIS Python plugin repository: ...


2

You can import multiple GPX files at a time, although you will be prompted each and every file for the data layer you want. With over 400 traces that's not going to be fun. You might want to look at ogr2ogr. This is the Swiss-Army-Knife of geo file conversions, it will convert almost any geoformat into any other compatible (vector/raster) geoformat. an ...


2

In the Metadata Layer Properties of your raster base, copy the equivalent of this information: Layer Extent (layer original source projection) 354971.3488602247089148,4414903.3223166307434440 : 479272.4038835020037368,4473428.4023900907486677 and put in this format: -te 354971.3488602247089148 4414903.3223166307434440 479272.4038835020037368 ...


2

Well I discovered after simply trying pretty much all keys possible. Backspace or del button does what is needed. Unfortuantely this is not shown at all in the QGIS menu interface. I will leave this answer so as to avoid frustration by future users.


2

This can be easily achieved with QGIS (I'm doing this in 2.10) and the Atlas generator. Open up your shapefile in QGIS. Symbolise it as desired. Project>New Print Composer Add a map to the layout that covers the whole page. After the map is added, we need to set it as controlled by atlas (select the map and go into Item properties): Next we set up the ...


2

I recommend becoming familiar with ArcGIS's Data Driven Pages toolbar. Set up a map file to appear as you desire, and then add the DDP toolbar. Click Set Up Data Driven Pages. Update the layer drop-down menu with the layer you wish to iterate through. On the extent tab, you can set a margin (that 'zoom out a tad more' part of what you're after). Once you ...


2

If you export the data using Save As ..., you can change the encoding to UTF-8. According to my answer for Incorrect display of national characters from Spatialite in QGIS, Windows, there are two ways of loading spatialite data into QGIS, which set the encoding on reading differently. You can try both and see which one works for you. This bug may be ...


2

If the number of polygons is relatively smaller and you prefer to keep the more detailed boundary I would probably make it semi-automatic way as following: remove the overlaps of less detailed polygon with Clipper plugin - you select more detailed polygon and use clipper which will remove all overlaps of other polygons. use AutoTrace plugin to quickly ...


2

In your __init__ function in plugin implementation find a line where your dialog was created. Probably it will be: self.dlg = CreateModelDialog() Then if you want to close dialog window you have to execute: self.dlg.close() Put this line into the function with your algorithm at the end of code. Example structure of your plugin.py: class ...


2

One method is to use the IN function followed by your list of values all inside brackets. E.g. "Column_Name" IN ('Value_1', 'Value_2', 'Value_N') Hope this helps!


2

The alternative is the use an AND/OR statement: "Column_Name" = 'Value_1' OR "Column_Name" = 'Value_2'


2

In the QGIS source code, you will find the Python code for the Points in Polygon tool ... https://github.com/qgis/QGIS/blob/master/python/plugins/fTools/tools/doPointsInPolygon.py Not sure why you are coding this from scratch. You might want to have a look at Processing which allows to combine these existing tools into automated workflows.


2

there are as always some options for the points you dont want: filter them out by a query, or what you probably are looking for edit them. For edits you must make the layer active in the TOC and then start the editing by pushing the yellow pencil icon. Further select the points you want to edit out and delete them with "delete selected". This process may ...


2

Obviously you can do rectangular bounding box selection with default selection tool with mouse/touchpad down + hold and move + up (there is also selection tool by polygon, freehand and elipse) You can also use Select features using expression and make selection by comparing feature Geometry xmin, xmax, ymin, ymax to your extent - minimum, maximum ...


2

If you pan or otherwise refresh the map it should update. This article says that you can use the following in PyQGIS: myLayer.triggerRepaint() To refresh all layers following function can be used: def refresh_layers(self): for layer in qgis.utils.iface.mapCanvas().layers(): layer.triggerRepaint()


2

From documentation: pushMessage(const QString &title, const QString &text, MessageLevel level=INFO, int duration=0) So, first and second agruments are strings. If you have some variables in your plugin, and you want to pass them into this function, you have to convert them to strings. For example we have a variable which contains coordinates and ...



Only top voted, non community-wiki answers of a minimum length are eligible