Tag Info

Hot answers tagged

24

If you have a Windows computer, you can use good 'ol CMD.EXE with a few esoteric for-loops. Make sure you do this in a "contained" directory with only the shp/sql files that you need to load. First step, create the SQL loader files (I also assumed you have Lat/Long WGS84 data with 4326 .. update this to your SRS): for %f in (*shp) do shp2pgsql -s 4326 %f ...


18

If want to stick to a GUI then the newer version of pgAdmin has Shapefile Loader that can be used as a bulk load


9

The following script clips polygon watersheds to polygon county boundaries, naming each output featureclass something like HspWBD_HU12_county name. Tested and it works. Make sure your values in the NAME field have no special characters or spaces (simple Python string methods can clean that up for you). import arcpy arcpy.env.workspace = ...


7

Recent versions of gdal_translate have support for KML Superoverlay. Although it is not yet documented on the GDAL website the following can be used: gdal_translate.exe -of KMLSUPEROVERLAY c:\in.tif c:\out.kmz -co FORMAT=JPEG This will save a tiled version in a kmz file using jpeg compression. On windows you can automate using forfiles /m *.tif /c "cmd ...


7

Two possibilities: Use wildcards to process all files in a directory: FOR %%F in (D:\Karten\shp\Gemeinden\*.shp) DO ogr2ogr -t_srs EPSG:31466 D:\Karten\shp\neu\%%~nxF %%F Use quotation marks around path and filename: ogr2ogr -t_srs EPSG:31466 "D:\Karten\shp\Test 1.shp" "D:\Karten\shp\Test 2.shp" EDIT This one works for me: for /R %%F in (*.shp) do ...


6

I don't have any specific links for you, but I think that you should look into the tools that already exist in ArcGIS Desktop. Have you looked into using Geoprocessing tools & models via python? A good place to start would be to make your Geoprocessing model & then export the model to Python. You can get more information ...


6

I think that all of listed by you software allow to execute batch converting in some way. ArcGIS I can explain how is it possible to perform in ArcGIS. Converting of one raster JPEG2000 -> GeoTiff can be done using tool Raster To Other Format (Conversion). Don't forget to setup appropriate raster storage settings in Environment variables when running ...


6

It isn't nice code, but for your specific circumstance, here is some python that should save typing them out by hand: f = open('list.txt', 'r') lines = f.readlines() for line in lines: lineparts = line.split(' ') outfile = open(lineparts[0], 'w') for i in range(1, 4): outfile.write(lineparts[i] + '\n') outfile.write(lineparts[4] + ...


5

Export Map Document to PDF is now included in the arcpy.mapping sample script tools Source Code is available to Automate/Batch MXD for Export to PDF.


5

Change your block: #Set the input datasets inputs = ConversionUtils.gp.GetParameterAsText(0) # The list is split by semicolons ";" inputs = ConversionUtils.SplitMultiInputs(inputs) With: inputs = [item.replace('\n', '') for item in open(filename).readlines()] Where filename is your file with the list of SHP ("Text File Sample").


5

Your script is trying to save each input to the same output shapefile. Since it is not set to overwrite existing data, it works the first time but not any time after that. The relevant line is: outdata=os.path.normpath(ConversionUtils.gp.GetParameterAsText(1)+path) To fix it, you will need to incorporate the outdata= line into your for input in inputs: ...


5

Here is a solution which is running quite fast (around 15 seconds for a 5 million random points which i created for Texas State). I normalized the multipoint input and it is giving satisfactory output. I am using Topology Framework .NET. It is similar to NetTopologySuite. Maybe you can do the same with NetTopologySuite as well. My solution (console ...


5

In your case (jpg rasters and exact same extent for all rasters) the Warp From File tool is just fine. If you haven't saved a link file yet you should do this first: Georeference one raster in ArcMap, click the View Link Table button and save the links to a text file using the Save button: Then there are different options: Batch: You can use the Warp ...


4

I have found the following utility to be quite helpful. THE LOST CARTOGRAPHER It was written by Ben Slater. In this blog post, he has given the code as well as the executable for Batch Printing ArcMap MXD Documents Edit: Added more information about the Utility, as per Matt Wilkie's suggestion


4

Many people have asked about this. At least one request (NIM013677) has been rejected with the status "as designed." The reason given is: Because when using the script version, the tool cannot know whether the target is a dataset or a feature class. It is designed to not support a feature dataset. Std Disclaimer: I work at Esri, but not on the ...


4

In your while loop, it is trying to output a shapefile. You can see this by the string the script tries to construct: gp.Clip_analysis(vector, feat, str(row.Watershed)+"_"+str(suffix)+".shp", "") Change to either: gp.Clip_analysis(vector, feat, str(row.Watershed)+"_"+str(suffix), "") or gp.Clip_analysis(vector, feat, str(n)+"_"+str(suffix), "") I think ...


4

Do you need to keep all of your intermediate intersects (ie- temp_poly0, temp_poly1)? If not, you will find that sending results to "in_memory" workspace will not only be easier to manage (all the data is cleaned up from memory on exit of the program, or you could just delete it from memory with arcpy.Delete to clear the memory space if you need to), you ...


4

I'm a little bit late, but hope it helps. Tuts and books If you want something learn about ogr, gdal, python and postGIS you can look at first on these pages and book. Geoprocessing with Python using Open Source GIS http://www.gis.usu.edu/~chrisg/python/ ogr http://www.gdal.org/ogr/ ogr2ogr - cheatsheet ...


4

some relevant functionality below. all of which is new at 10.1. with projected coordinate system, you have access to the GCS object which is where the datum info lives. if you're working with a GCS object already, just access the relevant datum properties (datumName, datumCode) directly. from_sr = arcpy.SpatialReference('NAD 1983 HARN UTM Zone 11N') to_sr ...


4

AWK is perhaps the most effective tool for such text conversion (although if you're familiar with Perl you might prefer it, out of habit): it was designed for exactly this kind of one-off quick reformatting work. Here is the full AWK code to perform the requested operation on the input specified: BEGIN {OFS="\n"} {print $2, $3, $4, $5 $6, $7, $8 > $1} ...


4

I guess you might want to append (>>) the projection to list.txt and not assign (>), otherwise list.txt will be overwritten at each iteration of your for loop. For /R %f in (*.tab) do ogrinfo -al -so %~dpnxf >> list.txt


4

ModelBuilder functions differently than batch processing in ArcGIS. Typically, you use iterators to loop through individual files rather than a spreadsheet-type list of files and actions, as in batch mode. The following is an example of the type of model you would need to loop through a workspace containing rasters in order to clip them to study area ...


3

As you use ArcGIS 10, i would use modelbuilder with builtin tool: Iteration Feature Selection to perform this task. See the pseudo-model in the picture. it does not need to know python scritping at all.


3

I routinely do this with GDAL and a simple bash script. You can also do ith with python, but I think this is quite straightforward and easier to understand #!/bin/bash # This script reprojects and subsets a bunch of HDF files stored in # a given dir (WORKDIR). The output is a GeoTIFF formatted file. # WORKDIR="./" # Where all HDF files are stored ...


3

A good place to start is the OGR toolset. This is a set of command line tools that can interact with spatial databases and could easily be formed into a batch file of commands. The ogr2ogr tool can be used to transform one dataset into another, whilst executing basic select queries or even arbitrary SQL. It acts as a single interface to lots of different ...


3

The Model Only Tool called Calculate Value can be run in Batch. To prove this to myself I did the following: Create a test feature class, add one feature and an empty field to it - I used Short Integer Write first tiny model with Iterator called For and Copy Features and run it to create five copies of the test feature class called test1, test2, ..., ...


3

I work at SmartyStreets and I've been working on a similar comparison for over two years now. As it turns out, even the almighty google gets some addresses wrong. I've compared google to ten other services that provide geocoding. Here's the comparison: https://docs.google.com/spreadsheet/ccc?key=0AidEWya_p6XFdGw1RmZ6TjB1ajZxVk81d2pISDMzVUE&usp=sharing ...


3

Try the following changes: # Batch Aggregate raster tool import arcpy, os from arcpy import env from arcpy.sa import * env.workspace = r"C:\rasters" out_workspace = r"C:\rasters\agg" rasters = arcpy.ListRasters() for raster in rasters: outAggreg = Aggregate(raster, 10, "MEAN") outAggreg.save(os.path.join(out_workspace, raster + "_agg.tif"))


2

Here is discussion of scripts (.bat files) for ArcGIS Server on EC2. Also, .bat files for starting/stopping arcgis services, as describe by Dave Bouwman: arcstart.bat net start MSSQLSERVER net start esri_sde net start "ESRI Image Server" net start "ESRIImageServerReporter" net start "ESRI Image ServiceProvider: 3983" net start ArcServerObjectManager ...


2

With a little scripting via ModelBuilder, I designed a tool that does what you are looking for. In essence, you convert the polygon (ExtendTo layer) to lines, merge the Input and ExtendTo layers, extend the input layer features, then remove all of the ExtendTo features. Because this model uses the "Extend Lines" tool introduced at 10.0, it obviously will ...



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