Tag Info

Hot answers tagged

3

# I know I repeat myself. Any idea to avoid it ? Move secteur = row.secteur outside the if/else statements (before if nbrow > 0:). Move rows = arcpy.SearchCursor(pochoir) inside the for loop (after for fc in fcList:) I think that you aren't accessing the geometry properly. Reference Reading Geometries and Working with geometry in Python. # tells ...


3

Numbers in any programming language does not have "absolute" precision. As they must be represented as bits in the computer hardware its precision is limited. Anyway review this links, because maybe they can help you: http://comments.gmane.org/gmane.comp.gis.gdal.devel/19331 http://lists.osgeo.org/pipermail/gdal-dev/2011-August/029793.html


2

Use a self-join of the same table twice with different alias. To find the intersection of one linestring with all others: SELECT b.id FROM trajectory a, trajectory b WHERE a.id = %s AND a.id <> b.id AND ST_Intersects(a.line_geometry, b.line_geometry) And to find all combinations of intersections of linestrings in the table: SELECT a.id || ' ...


2

If you happen to have all the featureclasses you want to convert in a map document, you could just run the Consolidate Map tool on that MXD. Make sure to check the "convert data to file geodatabase option". Inside the output folder will be one or more fgdbs (depending on how many source pgdbs held the original features). If you don't have an MXD with all ...


2

For this, you need to create new ogr features and save them to the layer and not simply create geometries ( geom1.AddPoint(linkpoint[0],linkpoint[1]), feature1.SetGeometry(geom1)), with dataSource.SyncToDisk() at the end (SyncToDisk() might be helpful to ensure that a particular feature is flushed to disk but it is not necessary here, look at the script). # ...


2

Works for me in QGIS 2.6 with Processing 2.6 (on Win7) and the test data Spatialite file from the repository. If you are using different data, please share it. Check if network and points are in the same CRS.


1

In the absence of a python parser your only real option is: replace(ltrim(replace( [field] ,"0"," "))," ","0") This assumes that you don't have any spaces inside your text, if you do then you need another two replaces: replace(replace(ltrim(replace(replace( [SourceFC] ," ","~"),"0"," "))," ","0"),"~"," ") Again, assuming that you have no ~ characters ...


1

I'm assuming that you are using ArcGIS 10.1 for Desktop or later, but this may also work with 10.0. Open up the Properties of your layer to the Labels tab. Make sure Label features in this layer is ticked on Change the Parser to Python. In the Expression area, if your field is called Name and your data is stored in a file geodatabase feature class, type: ...


1

In your solution you mix geometries and predicates of ogr and Shapely With Shapely only (intersection(), intersects()) from shapely.geometry import Point, LineString, mapping geom1 = LineString([(0, 0), (0, 1)]) geom2 = LineString([(1, 1), (-1,-1)]) intersection = geom1.intersection(geom2) # geo_interface -> GeoJSON mapping(intersection) {'type': ...


1

Your buffer distance is given in the units of your dataset. Your coordinate system is lon/lat geographic. Thus 0.01 = 0.01 decimal degrees. To be able to buffer by 1 km (1000 m) you need to reproject your dataset to a projected coordinate system which has units in metres. There are examples in the Python GDAL/OGR Cookbook of how to reproject layers and ...


1

If you don't need to stretch or rotate your raster, you can use the Shift tool (Data Management -> Projections and Transformations). Measure the offset in x and y, then run Shift incorporating these values. edit: this answer assumes ArcGIS, as listed in the original tags


1

mapLayersByName returns a list-of-QgsMapLayers so you need to use [0] at the end to just get the single one. The defintion for that function is: QList<QgsMapLayer*> QgsMapLayerRegistry::mapLayersByName(QString layerName) Which you can see returns a QList of QgsMapLayer, which is just a list of QgsMapLayers in Pythion. Use ...


1

On the first pass through the loop, the extent environment variable is set to the extent of the projected version of the first shapefile. On the second pass through the loop, the extent environment variable is still associated with the first shapefile. When Project is called, only the features within that extent are processed (presumably no features in the ...


1

This code has not been tested, but it should get you going in the right direction: import arcpy from arcpy.sa import * arcpy.env.workspace = "Path/To/Workspace.gdb" arcpy.CheckOutExtension("Spatial") #Static Variables field = "VALUE" #Build list of years rasters = arcpy.ListRasters("x_*, "ALL") #Loop through names, get year and use it to select rasters ...



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