Hot answers tagged

5

'<authority>:<code>' in the error means that you need just to use crs='EPSG:4326' instead of crs={'epsg:4326'}.


4

Here is a link to a related pyproj issue: https://github.com/pyproj4/pyproj/issues/538 Here is a link to more information about the axis order changes: https://pyproj4.github.io/pyproj/stable/gotchas.html#axis-order-changes-in-proj-6 In summary, you need to either be aware of your axis order on input/output or use the always_xy=True when creating the ...


3

Try: import arcpy, os shapefolder = r'C:\GIS\data\testdata' fields_to_check = ['PLACENAME','GNIS_ID'] for path, subdirs, files in os.walk(shapefolder): for name in files: if name.endswith('.shp'): fields = [f.name for f in arcpy.ListFields(os.path.join(path,name))] if any(f not in fields_to_check for f in fields): ...


3

Dont know what is fastest but I would try Topology: Create a file geodatabase - feature dataset - Import your data into the feature dataset then Topology: Create a new topology with rule "Must not self intersect": Validate:


3

Here are two possible solutions using both gdal and numpy. The first solution consists of looping through each pair of coordinates, getting the corresponding raster pixel and then, extracting its value along with their n neighbours. The second solution consists of a vectorized (and faster) version of the first solution. For the sake of this example, assume ...


2

Using a plugin: You can load JSON files from a directory structure, applying a prefix filter, using the Load Them All plugin v3.2.0. Load Them All will recognize sublayers into each JSON file and load them properly. Look at the docs to see some screencasts and details. Using PyQGIS: With the following script you can load your JSON layers and sublayers ...


2

I have ArcGIS and still prefer using TauDEM to do the job. E.g. this bat-file cd c:\Program Files\TauDEM\TauDEM5Exe mpiexec -n 8 pitremove -z "C:\scratch\dem" -fel ""C:\scratch\Filled.tif" mpiexec -n 8 D8FlowDir -fel "C:\SCRATCH\Filled.tif" -p "C:\SCRATCH\FDIR.tif" -sd8 "C:\SCRATCH\Slope.tif" mpiexec -n 8 AreaD8 -p "C:\SCRATCH\FDIR.tif" -ad8 "C:\SCRATCH\...


2

Found it. As simple as: layer = iface.activeLayer() layer.renderer().setForceRasterRender(True)


2

If you follow the instructions in how to Add Orfeo Toolbox to QGIS 3.X, it should work properly. There are two main steps you need to do: Download the Orfeo library Download the matching version for your operational system in the following address: https://www.orfeo-toolbox.org/orfeo-toolbox-6-6-is-out/ Download the Orfeo plugin files from gitlab You need ...


2

Here is a link to a related pyproj issue: https://github.com/pyproj4/pyproj/issues/538 Here is a link to more information about the axis order changes: https://pyproj4.github.io/pyproj/stable/gotchas.html#axis-order-changes-in-proj-6 In summary, you need to either be aware of your axis order on input/output or use the always_xy=True when creating the ...


2

As too often, I continue cobbling around with my code after having posted my question, and I figure it out: Short Do not pass a dictionary but a string as a CRS! Explanation I.e, in concrete terms, change the two previous pieces of code that thrown the FutureWarning into this: (...) t_srs = 4326 gdf.set_geometry('geom', crs=(u'epsg:'+str(t_srs))...


2

Here is a slightly hacky (but reasonably automated) solution based on method 1 from your question. which should do something close to want you want. The key here is setting up a list of colors which is passed to the render_raster() function. The length of this list is then used as the basis for number of classes etc. I used color name strings since they are ...


1

You're telling rasterio to write a dataset so it's expecting an array shape of (bands, rows, cols), but you're passing a single band, an array shape of (rows, cols). Either reshape your array: dest.write(single_band[np.newaxis,...])` Or tell rasterio to write a single band: dest.write(single_band, 1)


1

If it works when you pass a list of lists [[Fields_i[0], "SUM"],[... But not with a string representation of a list of lists: "[[Fields_i[0], "SUM"],[F.." #Fields_i[0] inside a string wont work/fetch correct fieldname. Then pass a list of lists. Try something like this: import arcpy fc = r'C:\somedb.gdb\somedata' Fields_i = [f.name for f in arcpy....


1

To select: If you want to keep at least one (random) record of those you are trying to identify as duplicates in the selection, run SELECT DISTINCT ON (val, ST_ClusterDBSCAN(geom, <threshold_in_CRS_units>, 0) OVER(PARTITION BY val)) * FROM points ; If you want to select only records that have no other point with the same value within <...


1

The filters (including the geometry filter) are for searching the catalog and finding images that match your criteria. Once found, the second step is to download (ignoring activation), and at this point you are downloading full images. In your script, however, you've skipped the search step since someone is providing the imagery to you and jumping right to ...


1

As I am able to solve this by installing libgdal-dev and pygdal (Virtualenv and setuptools friendly version of standard GDAL python bindings.) sudo apt-get install libgdal-dev In case not installed, install using aptitude sudo aptitude install libgdal-dev After that check GDAL version of your system, gdalinfo --version lets say you have GDAL version ...


1

It sounds like what you want is X,Y attributes in the file for the centroid, right? In Shapely, the centroid property of a geometry returns a Point object. You can get X and Y using the x and y attributes on that point, e.g. from shapely.geometry import Point point = Point(23, 42) print(point.x) print(point.y) You'll also want to alter your output ...


1

I do not have your data and have not tried to replicate this but in past experience with Geopandas and reprojecting I have found it is important to watch out using integers. Integers values in place of projection ESPG values can often cause errors and if they do not you may think things are fine. See these lines here: gdf.crs = 4326 gdf = gdf.to_crs(3857) ...


1

What you are trying to do can indeed be done with Fiona and Shapely. for this error: SyntaxError: positional argument follows keyword argument The problem is in your fiona.open call here: with fiona.open(r'C:\\Users\\Desktop\\GEM\20test\\counties\\counties2.shp' , 'w', 'ESRI Shapefile',output_schema, crs=input.epsg, 4326) as output: You have 4326 in the ...


1

Thanks @ustroetz for your excellent answer, it really helped me a lot. I will share an adjustment and extra step I implemented to remove the unsightly loops that appear as a consequence of the process. Note that this only works if your network is tree-like, which fortunately for my use case, mine always are. I introduce geopandas and networkx for this ...


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