Tag Info

New answers tagged

0

It looks like you are trying to specify all the fields in the join table to be pulled through. However, if you simply leave out that parameter, then they will all be pulled through by default. Why you get the error, I am not sure but I suspect it will be related to you trying to pull through OBJECTID (by specifically naming it) when there is already an ...


1

I've tried your code, but it not work. It can't find selected feature. So, I make an edit from your code. This is the edited code: def selectFeature(self, point, button): pntGeom = QgsGeometry.fromPoint(point) pntBuff = pntGeom.buffer((self.canvas.mapUnitsPerPixel() * 2), 0) rect = pntBuff.boundingBox() cLayer = ...


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.


1

Try something like that, where dx,dy are number of indexes: from osgeo import gdal file = gdal.Open( ’file.tif ’) def pixel(dx,dy): px = file.GetGeoTransform()[0] py = file.GetGeoTransform()[3] rx = file.GetGeoTransform()[1] ry = file.GetGeoTransform()[5] x = dx/rx + px y = dy/ry + py return x,y GetGeoTransform() function ...


0

Gdal probably has a handy function. Have you looked at these links? But knowing that the header of the image contains the bounding coordinates and projection information, you could calculate them yourself (not recommended unless you enjoy learning things the hard way). EX: I knew my pixel size was 30m. For point 3,4 from the origin it's simple algebra: 3x30 ...


2

I have tried to understand what you are asking without success. What I can say is that I think your code snippet should start from code like below: l = [[u'OBJECTID', 1.0 , 2.0 , 3.0 , 4.0 ], [u'LENGTH', 56.29, 61.8 , 11.01 ,164.03]] print l[0] From this you can see that a list gets printed: [u'OBJECTID', 1.0, 2.0, 3.0, 4.0] However, I am unable ...


1

My solution is to set up a startup script that sets of the path based on the python environment you are using. This method has the (huge) advantage that you don't need admin access to write .pth files in python installations. This script is setup to use both 32 bit and 64 bit Anaconda and ArcGIS/arcpy. # Startup script to link Anaconda python ...


1

To test your code I created a test feature class with two long integer fields: and ran this code: import arcpy in_fc1 = r"C:\Temp\test.gdb\PointFC" seq = [[7643, 7625], [9644, 2289]] Att_Dict = {} for pair in seq: Att_Dict[pair[0]] = pair[1] with arcpy.da.UpdateCursor(in_fc1, ['book_id', 'book_ref']) as cursor: for row in cursor: pozzy ...


4

Square brackets aren't used for the old version of cursors. Note that in the link your provided, the brackets are indexing a python list (alpha), not a cursor. For the newer data access version of cursors (da.SearchCursor, etc.), the brackets are used to reference the field index. For example, say you have a feature class and you want to iterate through its ...


0

According to the source code, this is a problem that has been fixed in GDAL 2.0. Whether it has or not, you can get around it by pre-filling the new raster with you preferred nodata value: outFileRead=driver.Create(outFilePath,X,Y,1,dataType,options) tmp = gdal.AutoCreateWarpedVRT(outFileRead, src_wkt, dst_wkt) b = outFileRead.GetRasterBand(1) ...


1

setSpatialFilter() is from GDAL/OGR not from Pyqgis. With PyQGIS, you have to deal with geometries. Check out the QgsGeometry class. It has few functions to check conditions: intersects, crosses, disjoint etc. So, to check if features in one layer intersects for example one feature in another layer, you have to get geometries of all features and check ...


-1

FOR WINDOWS 7 Right click on My computer > Properties > Advanced System Settings > click on “Environment Variables” button > If there is not a PYTHONPATH variable > New > and name it “PYTHONPATH” and values are added with “;” to include as many items as you want. C:\Program Files ...


1

EDITING: CALL QgsDistanceArea().computeAreaInit() wb=iface.activeLayer() feat = wb.selectedFeatures() area = QgsDistanceArea() #creating object area.setEllipsoid('WGS84') #setting ellipsoid True area.setEllipsoidalMode(True) #setting ellipsoidal mode area.computeAreaInit() # CALL THIS BEFORE CALCULATING AREA !!! geom = ...


3

I took a look at the source code for the shapefile and found this (line 507): elif typ == b('D'): if value.count(b('0')) == len(value): # QGIS NULL is all '0' chars value = None else: try: y, m, d = int(value[:4]), int(value[4:6]), int(value[6:8]) value = [y, m, d] ...


2

This looks familiar! Depending on where your data is stored, the formatting of field_name in the WHERE clause will vary. So, you can use AddFieldDelimiters to solve this for you. import os import arcpy in_feature = arcpy.GetParameterAsText(0) out_features = arcpy.GetParameterAsText(1) origin_year = arcpy.GetParameterAsText(2) field_name = ...


2

Ok without going into server authentication and everything, I think I have a simple solution to generate the form and allow the user to hit it. I was looking through the code, and it looks pretty incomplete (based off my quick scanning of the Qt info). The reason this code doesn't find anything is because the children (passField, nameField, loginButton) ...


2

From going off of what blah238 has mentioned, This question is really old, but I just wanted to point out that this is a really insecure way to do authentication since you're putting all the logic on the client side. You really need a some kind of authentication server for this, if security is important to you at all. It may be best to create a ...



Top 50 recent answers are included