Archive | Solutions to technical problems in GIS RSS feed for this section

How to Batch rename multiple files or folders

14 Jan


As you know, to rename lots of files or folders can be a pain so this post is just to share a really nice free software that I found today to rename multiple files or folders. It has been developed by Denis Kozlov and he have also other software that can be of interest to some of you 🙂


How to increase the allowance in the number of unique values in a raster for Classification

11 Jan

Hey again!

It’s has been a while since my last post, but I have to say that this is because I have been keeping myself busy with articles, conferences and so on so I have an excuse 🙂

Anyway, today I encountered another of those little problems that sometimes can make your life difficult.

If you open a raster in Arcgis and you dont want the default display, you can always get the layer properties and change the color ramp and so on. However, if you want to classify your values you have to choose: “Classified” or “Unique values” (depending on what you want). The problem comes when you have “to many” unique values in your raster so Arcgis does not allow you to change it.

Well, there is a simple solution to this, you just have to:

Go to tools/options

Go to Raster Tab

Click the Raster Attribute Table sub-tab

and finally increase the maximum number

This will allow you to compute all unique values you need to do a Manual classification or any other type you want. However, I have to say that if you have an old computer and thousands of unique values this will take a while…
I hope this is of some help 🙂

I’ll probably see you soon as I’m preparing myself for a hardcore modelling time in the next few months!

How to reclassify raster with batch file in Idrisi

30 Nov

Ok guys, today I had to reclassify a raster to create new ones with the values I needed. They were around 226 so I needed to make it an automatic process.  To do this in Idrisi you can create a batch file or macro. Although the process is fairly simple there are always good tips that can save you loads of time.

The way to start is to know the structure of module you want to reproduce in the macro. For “reclass” in idrisi you need the next parameters:

1.  x (to indicate that you are using macro mode)

2. File type (i for image, v for vector or a for attribute value file)

3. the input filename

4. output filename

5. classification type (1 for equal interval, 2 for user defined and 3 for file mode)

In my case, because I wanted to do my own classification I used type 2 in which you can repeat steps 6 to 8:

6. new value to be assigned to the old ones

7. old value (ranging from…)

8. old value (to those just less than…)

9. -9999 to indicate the end of the sequence

10 type of output data, 1 for integer and 2 for real.

To create the macro I use excel inputting these parameters to each cell in the datasheet:

Because you need to transform this into a macro file in Idrisi you have to save it as text. Any kind of text I have tried to save it directly from excel mess up the result so I found out that if better to do this:

I saved it as .CVS comma delimited, I opened it in word and did find and replace commas for space and then saved it as plain text.

Finally, you just open it with Edit in Idrisi save it as .IML and run the macro as usual!

I hope this is of some help because when you have 1,000,000 files to reclass it can be really handy!

Thanks to Boyd Zapatka in Clark Labs for his help!!! 🙂

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!

Error message displayed in the data view

26 Aug

I recently made an sql query with the “select by attribute” tool. An error message appeared in the screen (In data view) and since then I haven’t been able to remove it. This is not only annoying but also really bad as I cannot create any map that do not have the message in it!

I couldn’t find any post about this problem and what I ended up doing was just to transfer my layers from the old project to a new one…

Weird gis behaviour….

Populate a field with consecutive numbers

25 Aug

This is an old problem I encountered some time ago and the solution is rather simple, however to find it  proved to be time consuming so I thought that to share it here would be fine.

I basically wanted to create in an Arcgis shapefile  a field with consecutive numbers. This is easy to do by hand if you have 5 records, but if you have thousands you can find the solution in:

Enjoy your day 🙂

‘Invalid SQL’ error when using the BETWEEN operator in Arcgis

24 Aug

Ok, so I was basically trying to use a simple SQL operator to select in a  shapefile  polygons that had and “ID” number between 1-1500. It was  impossible for Arcgis 9.3 to understand the common syntax of :

WHERE “ID” between 1 AND 1500;

It always returned an error saying that an invalid SQL statement  was used.

After a while thinking about it I discovered that this other form actually works!

SELECT *FROM soils WHERE “ID” >=1 AND “ID” <=1500

I really don’t understand why it doesn’t accept the first form as I think is correct, but anyway, if somebody have the same problem this is a work around… 🙂

%d bloggers like this: