Tag Archives: Arcgis

Online tool to convert .kml to .shp

1 Aug

Hi guys, today I just wanted to share with you a very useful tool that I found.

Is called Kml2Shp and it exports online any kml to ESRI shapefile format or the other way around. Very nice tool 🙂


Script to sum values from one field and place them into another field ARCGIS

31 May

Hi guys,

Today I had to sum the values from a field from a raster file and write the output into another. Despite you’ll think that Arcgis would have a tool to do this in a simple way, I found out that this was not necessarily the case :p

I wrote an script in python to solve this. I hope you find it useful.

What the script does is to sum the values from a field writing the result into another field in the table.

You can copy this and add it into your toolbox 🙂

The arguments that are necessary are:

#(1) table = table containing the field you want to sum

#(2) fieldtosum= the field that you are going to sum

#(3) fieldwrite= the field in which the sum is going to be writen

import arcgisscripting, sys
gp = arcgisscripting.create()
table = sys.argv[1]
fieldtosum = sys.argv[2]
fieldwrite = sys.argv[3]

rows = gp.SearchCursor(table)
row = rows.Next()
p = 0.0
while row:
p += row.getvalue(fieldtosum)
print p
row = rows.next()
#calculate field

Very soon I’ll be writing about how to do a series of variants of visibility analysis such as “Directional Viewsheds” and “Higuchi Viewsheds” that can be very useful in archaeology 🙂

Workaround for Arcgis batch models (or what to do when batching a model just fails)

14 Feb

Ok, so many of you are probably already aware that when you create a model in Arcgis in order to batch it you need to make the variables lists. However, there are sometimes that this just fails and it not allows you to batch your model. I encountered this problem working with a quite complicated model and looking for different solutions I figured out this one. You can just create a script instead of a model, but if you don’t have time or you are not a super scripting nerd 😀 there is another way to make it work. Is actually quite similar to the way you do macros in IDRISI.

For the sake of explanation here Im going to put as example a simple process (create a buffer):

Let’s say you create your model and you want to batch process it.

1.Open the command line either in Arcmap or Arccatalog. To make sure that your model works well before you create your workflow in Excel, enter the parameters of your model in the command line and run it.

2. Once you are sure it is working properly, copy the parameters to a worksheet in excel.

(If you are using arccatalog you can set the absolute paths to your layers, but if you added all the information into an arcmap project the model will take the relative paths so in the parameters you can just input the name of the file rather than the whole path)

3. Once in excel you can just drag down the values filling up the parameters, modifying the names of the files you want to run in subsequent models.

4. Delete all the other sheets in the book (Sheet1,2 and so on TAB/right click/delete). Save as .cvs (Comma delimited).

(This will allow you to modify in the next step the file and save it directly to .txt)

5. Open it your word processor, click Find and Replace. Replace “,” for one space.

6. Save the document as .TXT

7. Open it in Notepad.

8. Copy and paste all in the command line and run it! (you are ready to go for a nice coffee while the machine works for you :D)

You can do the same with more complex models, just add the parameters that are necessary in your model.

Have a great day!

How to batch merge multiple shapefiles

11 Feb

Hey guys, in one of my last posts I shared a very useful tool to split a shp into several by attribute.  I found another great script by Gerry Gabrisch but this time to merge multiple shapefiles. There are several ways to do this and if you are not that familiar establishing the arguments or parameters in a Phyton script you will probably prefer this other utility.

Tlaloc bless the internet! 😀

Have a great weekend!

Converting a single shapefile into several (Split by attribute)

8 Feb

Hello again!

Just a quick note to tell you that today I found a very useful tool set to split a layer or shapefile in many shapefiles based in an attribute from the table.

This is a very quick way to separate a layer of roads, counties and so on. It was created by the USGS and have also another 3 additional tools.

I hope is as useful for you as it was for me 🙂

GIS Tool



Changing the symbols of an entire layer in ARCGIS

1 Feb

As always, there are small things that make our life easier when we are working with Arcgis. But sometimes, they are so obvious and -small-, that we tend to forget how to do them :p

This time, a friend had a layer with many roads and he asked me how to do all of them thicker. To change them all at the same time you just go to:

Layer properties/Symbology/Symbol Tab (above the lines representing each of the roads in this case)
Left click/ Properties for all symbols

There you can change the properties of all your features at the same time 🙂

Happy modelling…

How to import an Arcgis raster to Idrisi considering the “NoData” values

19 Nov

Hi again! The conversion between Arcgis rasters such as grids and others to the Idrisi format is fairly simple. However, when you run some of the analyses in Idrisi such as Varcost or to use the Land Change Modeller, you will realize soon that Idrisi gives you an error such as “floating point overflow” and others. This seems to occur when one or more of the rasters you are using have NoData values that are extremely large such as -9999.

The way to solve it is to reclassify your raster either in Arcgis or Idrisi:

1. In arcgis with the reclassification tool delete all the entries leaving only the “NoData” value. Give these values a new value of -1 (for instance)

2. If you have your file already in Idrisi, run reclassify and if you have for instance values of -9999 where in arcgis was NoData, you just Assign a new value of -1 To all values from -9999 To just less than 0.

I hope this is useful for somebody because it took me a while to find the solution to this 🙂

Have a great day!

%d bloggers like this: