Tag Info

New answers tagged

0

>>> outPoly = "C:\output\newpoly.shp" >>> print "'{0}'".format(outPoly) 'C:\output ewpoly.shp' >>> >>> outPoly = r"C:\output\newpoly.shp" >>> print "'{0}'".format(outPoly) 'C:\output\newpoly.shp' >>> This probably explains it best: https://docs.python.org/2.0/ref/strings.html


1

The sidebar in Google Earth lets you use the mouse to drag/drop items like polygons. You should be able to click & hold on one of your Untitled Polygons, move the mouse pointer up to the desired location in your My Places, and then release the mouse button to "drop" the polygon into that new location. In future, first select the folder where you want ...


2

You can use Foreign Data Wrappers, as of Postgres 9.2 (I think), from within Postgres to register a connection to another data source, either a Postgres server on another machine, or a completely separate data source. CREATE EXTENSION postgres_fdw; CREATE SERVER foreign_spatial_lite FOREIGN DATA WRAPPER postgres_fdw OPTIONS (dbname 'some_dbname', ...


0

You can only connected to one (and only one) database in the DB Manager to run the SQL window. So this is not possibly. Either your way of cloning the data, or making the join inside QGIS in the Properties > Joins tab of one of the layers.


1

This field calculator code (Python) assumes that green line is just a single shape: def Chainage(shp): mxd = arcpy.mapping.MapDocument("CURRENT") layers=arcpy.mapping.ListLayers(mxd,"line") lr=layers[0] with arcpy.da.SearchCursor(lr, 'Shape@') as cursor: for row in cursor: geom=row[0] p=shp.firstPoint L=geom.queryPointAndDistance (p) return L[3] ...


0

I will answer my own question. After some more research I found that the answer is to use feature layers (see ESRI's help page)rather than saving intermediate results in shapefiles. The select tool which was taking up to 6-7 minutes is now taking around 0.9 seconds. Quite the difference!


2

Not seeing your code, this may not work for you, but you can try to use the Python list selector: for row in sorted(arcpy.da.SearchCursor(fc, [f1, f2]))[:5]


1

Much easier if you post your table structure and what you've tried so far, but here goes. Assuming you have a table points with a column point of type geometry, and a table polygons with a column polygon of type geometry: SELECT p.* FROM points p INNER JOIN polygons y ON ST_CONTAINS(y.geometry, p.geometry) WHERE y.department = 'ZZ' If your points don't ...


2

I didn't find the option from the API, but you could mimic such behavior this way: I assume there are selected features already, so get their Ids: lyr = iface.activeLayer() selIds = lyr.selectedFeaturesIds() You said you have an expression, let's say: expr = QgsExpression( "\"NMG\" = 'CALI'" ) Now, get feature Ids that match your expression: it = ...


2

So it turns out the problem was a couple of humongous geometries in my table. One was 2GB and the other was 1 GB. This was a result of an ST_UNION I did and was not expecting that result! Killed those two records and the queries run much faster and the time to return results is more linear with larger limits. The large geometries were causing me all sorts ...



Top 50 recent answers are included