When I enter point id 1790 result join is only one input. I won from list all id_gm to be shown in atribute table of layer tacka6.  Can this be done in Qgis?    Solution
50143
I'm trying to create a join/relate in QGIS where I have a shapefile of buildings and to that I would like to join a non-spatial table (.csv-file) containing people who work in each building. So I have multiple records in my table that I would like to be able to join to my single features in my shapefile. I can only run a join in QGIS where the first record is joined to the shapefile feature (ie building) but subsequent records get removed. Could someone let me know how to complete this join/relate in QGIS?
61849
I have a small table of 10 cities (in one table) that I am snapping to the nearest road (in another table) with the following select and storing the table snapped_cities:  Select b.id, ST_Closestpoint(ST_Collect(a.geom), b.geom) as geom into snapped_cities from roads a inner join cities b on ST_Dwithin(a.geom, b.geom, 1000) group by b.id;   I would however like to have road ids and not just the geom (a.id above). How do I modify the select above to get these?  I use postgresql 9.2 and postgis 2.0  thanks,
108491
I'm facing troubles to import a layer into a PostGIS database with pyqgis in a script. Here is my code:  Nombre_BBDD='test' host='localhost'  puerto='5432' usuario='postgres' password='xxxxxxx' Nombre_Tabla='table' Llave_primaria='id' Capa_a_procesar='/xxxxxxx/shapefile.SHP' Tipo_geometria='POLYGON'  capaImportar = QgsVectorLayer(Capa_a_procesar, 'capaImportar', 'ogr') uri = """dbname='"""+Nombre_BBDD+"""' host='"""+host+"""'    port="""+puerto+""" user='"""+usuario+"""' password='"""+password+"""' key="""+Llave_primaria+""" type="""+Tipo_geometria+""" table=\"public\".\""""+Nombre_Tabla+"""\" (geom) sql=""" crs = QgsCoordinateReferenceSystem(25830) error = QgsVectorLayerImport.importLayer(capaImportar, uri, "postgres", crs, False, True)   I was trying to do it how is recommended in this .  It seems everything is right, but when I try to load the layer this is empty and the python console throws this error:     Exception RuntimeError: 'wrapped C/C++ object of type PGVectorTable has been deleted' in bound method PGTableDataModel.del of db_manager.db_plugins.postgis.data_model.PGTableDataModel object at 0x7f3f24190d60 ignored   I'm working with qgis 2.18.10 in a Kubuntu 16.04
77803
I have a vector layer, populated with points, and I want to programmatically add to this layer.  The part related to the geometry works just out of the box, but I was having trouble with adding attribute values to the new features.  The problem is, when I add a new feature to the layer, I do not manage to specify fields. The feature would complain on exceptions.KeyError.          featureList = []         ## now add the computed points to the layer         for p in [p for p in points.values() if p['computed']]:             x, y = p['coordinates']             feature = QgsFeature()             layerPoint = transf.transform(QgsPoint(x, y))             feature.setGeometry(QgsGeometry.fromPoint(layerPoint))             feature['id'] = p['id']             featureList.append(feature)          layer.dataProvider().addFeatures(featureList)         layer.commitChanges()   And before you ask, obviously I'm sure it's the feature['id'] which is giving trouble, not the p['id'].  So the short version of the question was "how do I specify fields of a feature before it was ever part of a layer?"
90812
I'm trying to create a visual map in QGIS 2.4 of the approximate distribution of journey origin points using a shapefile of UK postcode sectors, layer joined to a table with a column giving the number of journey origins in each sector. Using the Vector > Research Tools > Random Points menu tool, I can select the Input boundary layer and click the 'Use value from input field' radio button, but the pull-down menu to select the required field does not seem to work. If I then specify the Output Shapefile name and target location , I get an error message - "Errors: The following features IDs couldn't be calculated due to conversion error: 335, 335". To confirm, QGIS does display random points if I specify the density or a specific number of points using the first two 'Stratified Sampling' Designs for individual polygs.
99349
I have created a point layer with ~150 points. I have a DEM beneath it, which is where I have taken the X and Y values from.   Does anybody know how I can retrieve the Z values, without using the info button?  I am using ArcGIS Desktop 10. I have licences for the spatial analyst etc tools.
76639
I'm new to QGIS and I'm using QGIS 3.14. I was following the tutorials, and I got stuck in adding my very first new vector layer. Every time I tried to do the option new Vector layer, no map appears and the the attribute table is empty.  I tried using other shapefiles, the same thing happens, no map and no attributes. I have also tried using older versions but none works. What do I do?
121701
I'm a beginner QGIS user and am struggling with creating a grid. I've used the MMQGIS geometry import function to import data from the CSV file shown below but they pop up as points on QGIS. I want to make it into a grid so that I can pretty much have each of the points be in a box format. I've also tried to use the join function but am not sure what variable both the grid and the points have so that I can join them.
116632
This might be a very simple thing, but I just can't figure it out how to do it in QGIS (alternatively I'm also grateful for explanations for ArcGIS). I have a fisheries dataset with multiple catches in one location. I'd like to display these catches as a dot varying in size according to the number of catches - like dots displaying population size in a city. However, the excel sheet I have is one catch each row, with the same coordinates but different attributes (length, weight, etc). Is there a tool in QGIS that can merge all points in one location (other attributes not needed then)? Thanks a lot for your help!
21396
I've imported several shapefiles which where exported from a Mapinfo .tab. Several  .tab-files are imported resulting in 20+ layers. Afterwards I want to export it to GeoJSON; but I'm reluctant to select each layer and export it manually. Is there a way to merge all the layers into one using QGIS?
76206
Does anyone know if it's possible to do a 'one to many' spatial join based on distance in QGIS?  The "Join Attributes By Location" under ->Vector->Data Management Tools is very limited...  Just to be clear, below is how it's done in ArcGIS.
43989
In the Upslope Area tool from SAGA it used to be possible to import the point file with multiple points and it would create several catchment/basins areas for those points. Now, it is only possible to MANUALLY enter coordinates for only 1 point. However, for a model we're building, we need to perform this analysis 24 times (as we have 24 different points) so we need to automate this process. I tried to use Run as Batch process + calculate by expression and get the XY coordinates from another layer, however, I run into the problem that I need to reference the XY coordinates that are stored in the other layer and looks like there isn't an easy way of doing so. Any suggestions on how to do that? Tried the geomwithin(targetLayer,targetField) from RefFunctions plugin but that produces empty result  so to resume, I have two questions:   How to calculate upslope areas for multiple points? Is there a way to automatize it in the graphical modeler?
106953
Is there something out there for QGIS that is similar to the Append Tool in ArcMap? Reason I am looking: I am currently working on a storm drainage project that involves GPSing Storm drain lids. My issue is when I capture the points with the GPS unit, and then bring them into the office. The GPS unit produces a CSV file for me to import into QGIS. It gives the CSV file with generic header names ( field1, field2, field3..etc) This is fine, until I try to copy it into the working shapefile that has all the other storm drains. The beautiful thing with ArcMap's append tool was that I could map each field from my CSV file to the destination shape file...ex... &quot;field1&quot; from CSV is equal to &quot;Elevation&quot; field in my shapefile. And thus update my shapefile with the newest points.
19134
I am trying to import a CSV file into QGIS, but it ends up looking like my print screen below (program is in Swedish but in the preview window you can see how QGIS won't read my data correctly). I can't load the data since for some reason, QGIS reads my CSV table columns as one single row. What is wrong? I want QGIS to read my data as numbers, so I have created an additional csvt-file with the code "String","String","Integer". Is there something else that I need to to in order for QGIS to read the third column as numbers?      Still, after doing that it loos like this...
38550
I run processing.run(&quot;native:buffer&quot;) and from newly created vector I get all features and export them to string using QgsJsonExporter(). My problem is that newly created vector gives new IDs to all features and they aren't equal to attribute ID's values. And after exporting them to GeoJSON using QgsJsonExporter() I get GeoJSON features with identifiers. However I can solve this by declaring processing.run(&quot;native:buffer&quot;) algorithm OUTPUT to .geosjon file and opening it afterwards. Is there a way that I can get GeoJSON string without IDs without having to save OUTPUT to .geojson and reading it to string afterwards. vl = QgsVectorLayer(sys.argv[1],&quot;mygeojson&quot;,&quot;ogr&quot;)  def runProcessingNativeBuffer(inputGeoJson, distance):     processing.algorithmHelp(&quot;native:buffer&quot;)     return processing.run(&quot;native:buffer&quot;,                          {'INPUT': inputGeoJson,                           'DISTANCE': distance, 'SEGMENTS': 5,                           'END_CAP_STYLE': 0, 'JOIN_STYLE': 0,                           'MITER_LIMIT': 2, 'DISSOLVE': False,                           'OUTPUT': &quot;TEMPORARY_OUTPUT&quot;})  ats = runProcessingNativeBuffer(vl, sys.argv[2])  vl1=ats['OUTPUT']  features = vl1.getFeatures() exporter = QgsJsonExporter() print(&quot;GEOJSON&quot;,exporter.exportFeatures(features))  IDs in properties are fine I don't need additional IDs in &quot;features&quot;
50222
I am trying to create a grid road map with an index table for street look up.  I am using this tutorial by ESRI:   I am at the step whereby I am supposed to spatially join a point file (centroid point for each label) to a grid (which has the grid ID):      The next step is to use the Spatial Join tool (one to many is the join   option) and join the annotation to each grid cell they fall within.    However, you will likely not want to work directly with the annotation   because the spatial join options for “contains” or “within” will not   include any annotation that overlaps more than one grid cell. Further,   the “intersects” option will create duplicate entries in the same   circumstances. To get around that convert the annotation to point   features using the Feature to Point tool (Important note: I had to   delete the Element field; the type is blob, the field isn’t needed,   but if it’s there, the tool won’t run).   It seems to be telling me to spatially join the points to the grid in order to match up each label point with its grid ID value. However, whenever I spatially join, the output table is empty.   Any advice? I simply need to find a way to extract the grid ID of where the points falls within the grid.     I've included a photo of the spatial join parameters. After the process runs, it simply spits out a new shapefile with no features and an empty attribute table.
71133
I'd like to insert an input variable (integer) in a query SQL (@variable) using the algorithm postgresql execute sql in the graphical modeler of QGIS. For example, in this kind of query INSERT INTO table2 SELECT * FROM table1 WHERE ID = @variable;  where I should insert the variable in the input panel of the modeler and click play to do the query. I used pre-calculated value but with no success. Any suggestion?