Tag Info

Hot answers tagged

3

This works for me. Are you trying to drag it from the Project Pane (either Folder or toolbox node) into Modelbuilder? Either make a connection to the folder the TBX lives in, or from the Toolbox node, right click and add toolbox pointing to your existing tool. If you're trying to drag from ArcMap to Pro, this wont work.


3

Try this: import os, glob, shutil root_dir = "C:\Users\xxxx\Desktop\Test\\" country_dir = "Country_" grid_path = "C:\Users\xxxx\Desktop\Test\Grid\Grid.shp" # Get all files that constitute the Grid Shapefile gridShpFiles = glob.glob(grid_path[:-3]+"*") for path,dirname,files in os.walk(root_dir): if country_dir in path: for f in gridShpFiles: ...


3

Yes, you can run multiprocessing child processes from a toolbox script. Below is some code to demonstrate in a Python Toolbox (*.pyt). There are a number of "gotchas". Some (but not all) will be applicable to Python script tools in a binary toolbox (*.tbx), but I only use Python Toolboxes these days so have not tested. Some "gotchas"/tips: Make sure ...


2

The Origin-Destination Cost Matrix is the best workflow in Network Analyst for processing thousands of routes at once. It could easily generate a table with 250,000 rows describing the travel time between each unique pair of nodes. However, OD Cost matrix does not export the actual route geometry between each origin and destination, as stated in the Esri ...


2

When working with large tables and performing joins I would recommend creating an attribute index for both tables, Add Attribute Index, this should help the overall process speed wise.


2

I am not an ArcGIS user, but the following links may contain information and tips on how to add layers to your TOC: Add layer in ArcGIS Use python to add layers to TOC How to add several layers to the table of contents in ArcMap using Python in one shot?


2

Try changing this line: outputs_2=general.runalg("qgis:clip", outputs_1['SAVENAME'], file, os.path.sep.join(path.split(os.path.sep)[:-1]) + os.path.sep + processed_dir + os.path.sep + file) to: outputs_2=general.runalg("qgis:clip", outputs_1['SAVENAME'], file, os.path.join(os.path.dirname(path), processed_dir, file))


2

Assuming that you always want to match like files from Original and Processed folders (i.e. Paris(O).shp always matched with Paris(P).shp or New York City(O).shp always matched with New York City(P).shp), You need to add a conditional after your second for loop to filter out everything you are grabbing from the processed folder. for f in glob.glob(root_dir ...


2

For the first question: You need to create a QgsVectorLayer object from your Shapefile path. Only then you can access the getFeatures() function. That is: for fname in glob.glob(path_dir + "*.shp"): for feature in QgsVectorLayer(fname,"any name","ogr").getFeatures(): My recommended way of doing it You don't actually need to access getFeatures() nor ...


1

Why not just use the Delete Field tool within the Fields toolbox? ArcToolbox --> Data Management Tools --> Fields --> Delete Field Choose your input table/feature class, and select the fields you want to remove. If you want to script it out to delete certain fields every time, it'd be pretty easy. arcpy.DeleteField_management(in_table, ...


1

I've tested the following script on GNU/Linux, QGIS v.2.8.1, Processing v.2.6 and Processing v.2.9.1. import sys,os,glob from qgis.core import * from PyQt4.QtGui import * app = QApplication([]) QgsApplication.setPrefixPath("/usr", True) # Adjust it to your path QgsApplication.initQgis() path_dir = "/docs/borrar/test/" path_res = path_dir + "results/" ...


1

os.walk returns a tuple of three values: for path, dirs, files in os.walk() Also consider http://stackoverflow.com/questions/2186525/use-a-glob-to-find-files-recursively-in-python


1

Following the idea from Cannot rename output file using standalone script for QGIS, I would do something like this: for file in files: if file.endswith('.shp'): pieces = list(os.path.splitext(file)) pieces[0]=pieces[0][:-3]+"(B)" newFile = "".join(pieces) outputs_2=general.runalg("qgis:clip", outputs_1['SAVENAME'], ...


1

After a little editing i used this script and its working fine. Now i just have to do it for each ID and for each day :-) library(SDMTools) library(rgeos) library(maptools) library(lubridate) #points <- readShapePoints("C:/Users/mlra/Desktop/FunWithDistance/DummyBird.shp") points <- tellus_2012_2013 lon <- as.vector(points$long) lat <- ...


1

It all depends on the level of accuracy that you need. A coarse approach would be the spherical law of cosines. This has issues with small distances - some say that it is around 1km, others say down to a few meters. A better approach would be the Haversine Formula. This works well, however, it doesn't take into account that the earth is not actually a ...



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