Sunday, 30 January 2011

Converting raster dataset to XYZ in ARCGIS !!


It is most probable that you might have to convert from XYZ data to raster image and vice versa because there are applications which can only read XYZ data for visualizing and analyzing. In my case, I always use MATLAB for such case where I can process numbers of images in a loop. One of reader send me an email asking to show a way to do such tasks in ArcGIS. So, here I will show how to convert raster dataset to XYZ. Of course, the way I show can be executed for numbers of images by using python. If someone interested in that, shoot me an email. I will duly oblige.

Steps:
1) Open your raster image in  ArcMap.
2) Open the Sample tool from ArcToolbox>Spatial Analyst Tools >Extraction.
3) Select the raster dataset as the Input Raster and select the raster dataset again in the 'Input location raster or point feature'. Choose ' Resampling technique' is set to Nearest.
4) Specifiy an output table.
5) The output table is in the format: Object ID, Z, X, Y and Z. The sample file would look like in the following figure.


6) Open the table. Right click a field that you are not interested in and choose 'Turn Field Off'. Do this of for all of fields that is not of interest.
7) Right click the table and  choose Data >Export and give an appropriate name and you are done.

Converting raster dataset to XYZ in ARCGIS !!


It is most probable that you might have to convert from XYZ data to raster image and vice versa because there are applications which can only read XYZ data for visualizing and analyzing. In my case, I always use MATLAB for such case where I can process numbers of images in a loop. One of reader send me an email asking to show a way to do such tasks in ArcGIS. So, here I will show how to convert raster dataset to XYZ. Of course, the way I show can be executed for numbers of images by using python. If someone interested in that, shoot me an email. I will duly oblige.

Steps:
1) Open your raster image in  ArcMap.
2) Open the Sample tool from ArcToolbox>Spatial Analyst Tools >Extraction.
3) Select the raster dataset as the Input Raster and select the raster dataset again in the 'Input location raster or point feature'. Choose ' Resampling technique' is set to Nearest.
4) Specifiy an output table.
5) The output table is in the format: Object ID, Z, X, Y and Z. The sample file would look like in the following figure.


6) Open the table. Right click a field that you are not interested in and choose 'Turn Field Off'. Do this of for all of fields that is not of interest.
7) Right click the table and  choose Data >Export and give an appropriate name and you are done.

Thursday, 13 January 2011

Data Driven Map Book in ArcGIS 10

During my work, i often have to prepare layouts in arcgis which is only different in what is displaying in the main dataframe. For example often i have a big orthophoto and i have to prepare layouts showing portion of it in big scale together with a overview picture so that a user would know where he/she is looking. If i divide my othophoto frame into 9 parts then i would have prepare same layout 9 times each time panning  data in main frame to different extent. But, now i am happy that there is data driven map book in arcgis 10 which will make my such tedius task much simplier and easier.

I have a polygon data of wards within Kirtipur and a table with a locations of schools within the area. With using join by spatial location, i attached number of schools in each ward to the polygon data. Then the polygon was visualized in catagories using symbology tab.

Now, here things get interesting. Now i need pdf displaying each ward number in zoom and also a description  specifying how many schools within that particular ward number. That means the extent in main frame in layout and text should be automatically update based on the data.

Steps:

a) Go to layout tab and design your layout as necessary. Insert another data frame which would act as a overview. Display the layers in the overview dataframe as required. Righ click in overview data frame, select properties and go to Extent Indicator tab and select the main data frame. This will highlight the area as the extent in the main data frame changes.


2) Right click anywhere in toolbars and make Data Driven Pages toolbar visible.Click atu Setup Data Driven pages. Check Enable DataDriven pages. Select approriate layer and field  based on which one wants to create data driven pages.


3) From data driven toolbar, click next and you will see layout would change automatically.


4) Now we want to export it as pdf. From file choose export map and save the file. 



5) The layout for one ward no is shown as below. Click here if you want to download the data driven map book as pdf thus created and see how it looks.

Data Driven Map Book in ArcGIS 10

During my work, i often have to prepare layouts in arcgis which is only different in what is displaying in the main dataframe. For example often i have a big orthophoto and i have to prepare layouts showing portion of it in big scale together with a overview picture so that a user would know where he/she is looking. If i divide my othophoto frame into 9 parts then i would have prepare same layout 9 times each time panning  data in main frame to different extent. But, now i am happy that there is data driven map book in arcgis 10 which will make my such tedius task much simplier and easier.

I have a polygon data of wards within Kirtipur and a table with a locations of schools within the area. With using join by spatial location, i attached number of schools in each ward to the polygon data. Then the polygon was visualized in catagories using symbology tab.

Now, here things get interesting. Now i need pdf displaying each ward number in zoom and also a description  specifying how many schools within that particular ward number. That means the extent in main frame in layout and text should be automatically update based on the data.

Steps:

a) Go to layout tab and design your layout as necessary. Insert another data frame which would act as a overview. Display the layers in the overview dataframe as required. Righ click in overview data frame, select properties and go to Extent Indicator tab and select the main data frame. This will highlight the area as the extent in the main data frame changes.


2) Right click anywhere in toolbars and make Data Driven Pages toolbar visible.Click atu Setup Data Driven pages. Check Enable DataDriven pages. Select approriate layer and field  based on which one wants to create data driven pages.


3) From data driven toolbar, click next and you will see layout would change automatically.


4) Now we want to export it as pdf. From file choose export map and save the file. 



5) The layout for one ward no is shown as below. Click here if you want to download the data driven map book as pdf thus created and see how it looks.

Monday, 10 January 2011

ArcPy : Python scripting in ArcGIS 10

My hands were itching to get hold of newest version of ArcGIS for a really long. Finally, couple of days  back, i got ArcGIS in my aresnal. I am quite excited about it. ArcGIS 10 has introduced a lot more functionality for automation and analysis. The layout has now much elegant look compared to previous version where user can dock different window in sides as well as in bottom and its dock able. That means much more space to work.  The new tools such as split raster and raster mosaic are some of the tool that I wished ESRi had incorporated in its products much earlier.

It comes with numerous new and powerful tools such as ArcPY which provides an interface for a developer to program within the ArcGIS ! Till ArcGIS 9.3, writing python scripting in ArcPY required separate Python IDE. I have played around with ArcPY and i am amazed to see numerous operation it can perform and that too in just few lines of python scripting. Moreover it comes with intelligent window which helps you to complete code with instant help.

Today i will show you, how with simple and few lines, you can start doing geo processing with ArcPY.

The first line in picture imports complete modules which gives access to all the geoprocessing function and properties that are within that. This line is generally a starting line in any python scripting in ArcGIS. ArcGIS also includes other modules such as arcpy.sa for spatial analyst, arcpy.ga for geostastical analyst and arypy.mapping for mapping.

The second line specifies the workspace where we are going to store our features. The final line creates a buffer around the feature "schools", of 1000 feet and stored with a named with "Buffer_1000". It's easy like that!

You might say, I can do this thing with tools available within in arc catalogue toolbox easily with few clicks, so what this fuss about arcpy and why this arcpy would even needed! You are right! The true power of arcpy comes to play if you want to do a batch processing i.e. repeating same thing numbers of times.

In above case, if I wanted to carry buffer analysis with 1000 and 2000 feet then I have to carry the buffer analysis two times with same parameter only changing buffer distance. Things like this can easily be carried out with arcpy with a loop. The variable, "i" stores distance values which I want to buffer around the feature "schools". The variable "savenames" will generates string such as Buffer_1000 and Buffer_2000.


Here is the final output as viewed in arcgis 10. Notice the dockable windows in the sides of the picuture and python window at the bottom.






ArcPy : Python scripting in ArcGIS 10

My hands were itching to get hold of newest version of ArcGIS for a really long. Finally, couple of days  back, i got ArcGIS in my aresnal. I am quite excited about it. ArcGIS 10 has introduced a lot more functionality for automation and analysis. The layout has now much elegant look compared to previous version where user can dock different window in sides as well as in bottom and its dock able. That means much more space to work.  The new tools such as split raster and raster mosaic are some of the tool that I wished ESRi had incorporated in its products much earlier.

It comes with numerous new and powerful tools such as ArcPY which provides an interface for a developer to program within the ArcGIS ! Till ArcGIS 9.3, writing python scripting in ArcPY required separate Python IDE. I have played around with ArcPY and i am amazed to see numerous operation it can perform and that too in just few lines of python scripting. Moreover it comes with intelligent window which helps you to complete code with instant help.

Today i will show you, how with simple and few lines, you can start doing geo processing with ArcPY.

The first line in picture imports complete modules which gives access to all the geoprocessing function and properties that are within that. This line is generally a starting line in any python scripting in ArcGIS. ArcGIS also includes other modules such as arcpy.sa for spatial analyst, arcpy.ga for geostastical analyst and arypy.mapping for mapping.

The second line specifies the workspace where we are going to store our features. The final line creates a buffer around the feature "schools", of 1000 feet and stored with a named with "Buffer_1000". It's easy like that!

You might say, I can do this thing with tools available within in arc catalogue toolbox easily with few clicks, so what this fuss about arcpy and why this arcpy would even needed! You are right! The true power of arcpy comes to play if you want to do a batch processing i.e. repeating same thing numbers of times.

In above case, if I wanted to carry buffer analysis with 1000 and 2000 feet then I have to carry the buffer analysis two times with same parameter only changing buffer distance. Things like this can easily be carried out with arcpy with a loop. The variable, "i" stores distance values which I want to buffer around the feature "schools". The variable "savenames" will generates string such as Buffer_1000 and Buffer_2000.


Here is the final output as viewed in arcgis 10. Notice the dockable windows in the sides of the picuture and python window at the bottom.