Chapter 6: Relationships Between Two Variables: Cross-Tabulation
CrossTab - Welcome to Zhuoyue's PORTFOLIO! · 2018. 8. 30. · Crosstab toolbox could achieve...
Transcript of CrossTab - Welcome to Zhuoyue's PORTFOLIO! · 2018. 8. 30. · Crosstab toolbox could achieve...
![Page 1: CrossTab - Welcome to Zhuoyue's PORTFOLIO! · 2018. 8. 30. · Crosstab toolbox could achieve following objectives: Produce cross-classification image. Create cross-tabulation table](https://reader033.fdocuments.in/reader033/viewer/2022061000/60af63618e0738140559f404/html5/thumbnails/1.jpg)
CrossTab
Zhuoyue Zhou, Zifeng Li, Xiaoyan Hu
![Page 2: CrossTab - Welcome to Zhuoyue's PORTFOLIO! · 2018. 8. 30. · Crosstab toolbox could achieve following objectives: Produce cross-classification image. Create cross-tabulation table](https://reader033.fdocuments.in/reader033/viewer/2022061000/60af63618e0738140559f404/html5/thumbnails/2.jpg)
Why we chose it?The Land Change Modeler in Terrset provides a rapid assessment of land cover change, presenting the change, persistence and specific transition both in map and graphical form.
But In ArcMap, the way to conduct these analyses is using the Tabulate Area tool, which could generate outputs that are in areas not in amount of cells, and could not provide a map to display land cover change.
![Page 3: CrossTab - Welcome to Zhuoyue's PORTFOLIO! · 2018. 8. 30. · Crosstab toolbox could achieve following objectives: Produce cross-classification image. Create cross-tabulation table](https://reader033.fdocuments.in/reader033/viewer/2022061000/60af63618e0738140559f404/html5/thumbnails/3.jpg)
Research Objectives:Create crosstab toolbox, which performs a cross-tabulation analysis that compares images
containing categorical variables.
The crosstab tool could produce cross-classification image to show the transition between categories in the two images.
The crosstab tool could create a tabular matrix that shows the number of pixels that correspond to each combination of categories in the two (column-row) images being compared.
The crosstab tool could create a bar chart that shows the number of pixels in each category that correspond to two images being processed.
The crosstab tool could create map to present the transition from one category to another category, from one to many other categories or from many categories to one.
![Page 4: CrossTab - Welcome to Zhuoyue's PORTFOLIO! · 2018. 8. 30. · Crosstab toolbox could achieve following objectives: Produce cross-classification image. Create cross-tabulation table](https://reader033.fdocuments.in/reader033/viewer/2022061000/60af63618e0738140559f404/html5/thumbnails/4.jpg)
Flow Chart
![Page 5: CrossTab - Welcome to Zhuoyue's PORTFOLIO! · 2018. 8. 30. · Crosstab toolbox could achieve following objectives: Produce cross-classification image. Create cross-tabulation table](https://reader033.fdocuments.in/reader033/viewer/2022061000/60af63618e0738140559f404/html5/thumbnails/5.jpg)
Interface
![Page 6: CrossTab - Welcome to Zhuoyue's PORTFOLIO! · 2018. 8. 30. · Crosstab toolbox could achieve following objectives: Produce cross-classification image. Create cross-tabulation table](https://reader033.fdocuments.in/reader033/viewer/2022061000/60af63618e0738140559f404/html5/thumbnails/6.jpg)
Edit ToolValidator Class
Reference: http://gis.stackexchange.com/questions/113879/setting-up-drop-down-list-in-parameters-of-python-script-tool
Main Steps:
Define the function updateParameters(), which enables user to choose categories from drop down lists.
![Page 7: CrossTab - Welcome to Zhuoyue's PORTFOLIO! · 2018. 8. 30. · Crosstab toolbox could achieve following objectives: Produce cross-classification image. Create cross-tabulation table](https://reader033.fdocuments.in/reader033/viewer/2022061000/60af63618e0738140559f404/html5/thumbnails/7.jpg)
Import module:
![Page 8: CrossTab - Welcome to Zhuoyue's PORTFOLIO! · 2018. 8. 30. · Crosstab toolbox could achieve following objectives: Produce cross-classification image. Create cross-tabulation table](https://reader033.fdocuments.in/reader033/viewer/2022061000/60af63618e0738140559f404/html5/thumbnails/8.jpg)
Main Function
![Page 9: CrossTab - Welcome to Zhuoyue's PORTFOLIO! · 2018. 8. 30. · Crosstab toolbox could achieve following objectives: Produce cross-classification image. Create cross-tabulation table](https://reader033.fdocuments.in/reader033/viewer/2022061000/60af63618e0738140559f404/html5/thumbnails/9.jpg)
CrossTab Image:
Main steps:
Detect the transition condition between categories and assign values for corresponding pixels in the output image.
Replace the randomly chosen values to values based on the order of values in the input images.
![Page 10: CrossTab - Welcome to Zhuoyue's PORTFOLIO! · 2018. 8. 30. · Crosstab toolbox could achieve following objectives: Produce cross-classification image. Create cross-tabulation table](https://reader033.fdocuments.in/reader033/viewer/2022061000/60af63618e0738140559f404/html5/thumbnails/10.jpg)
Figure:
Main steps:
Calculate the total number of pixels for each category.
Matplotlib function
Reference: https://plot.ly/python/bar-charts/
![Page 11: CrossTab - Welcome to Zhuoyue's PORTFOLIO! · 2018. 8. 30. · Crosstab toolbox could achieve following objectives: Produce cross-classification image. Create cross-tabulation table](https://reader033.fdocuments.in/reader033/viewer/2022061000/60af63618e0738140559f404/html5/thumbnails/11.jpg)
Main Steps:
Calculate the maximum value for y axis.
Format output, including bar width, legend extent and font size.
![Page 12: CrossTab - Welcome to Zhuoyue's PORTFOLIO! · 2018. 8. 30. · Crosstab toolbox could achieve following objectives: Produce cross-classification image. Create cross-tabulation table](https://reader033.fdocuments.in/reader033/viewer/2022061000/60af63618e0738140559f404/html5/thumbnails/12.jpg)
Report:
Main Steps:
Summary the total number of pixels that represent the change from one category to another one in two images.
Calculate number of persistent pixels.
![Page 13: CrossTab - Welcome to Zhuoyue's PORTFOLIO! · 2018. 8. 30. · Crosstab toolbox could achieve following objectives: Produce cross-classification image. Create cross-tabulation table](https://reader033.fdocuments.in/reader033/viewer/2022061000/60af63618e0738140559f404/html5/thumbnails/13.jpg)
Boolean Images: One-to-One
-The (key, value) in dictionary_sort{} stands for the (category, pixel value) in the cross-classification image.-Randomly define two categories x and y to calculate the land change from x to y. -Look up the key (x, y) in dictionary_sort{}:-Existing: loop the cross-classification image and
assign the value of key(x,y) to a new blank image at the corresponding location.-Not: no change & a black image.
![Page 14: CrossTab - Welcome to Zhuoyue's PORTFOLIO! · 2018. 8. 30. · Crosstab toolbox could achieve following objectives: Produce cross-classification image. Create cross-tabulation table](https://reader033.fdocuments.in/reader033/viewer/2022061000/60af63618e0738140559f404/html5/thumbnails/14.jpg)
One-to-AllSimilar method to one-to-one.-Randomly assign a value for x and place y as the variable.-For each key(x,y) in keys(x,y), look it up in the dictionary_sort{ }:-Exsiting: loop the cross-classification image and
assign values to a new blank image.-Not: look up for the next one.
![Page 15: CrossTab - Welcome to Zhuoyue's PORTFOLIO! · 2018. 8. 30. · Crosstab toolbox could achieve following objectives: Produce cross-classification image. Create cross-tabulation table](https://reader033.fdocuments.in/reader033/viewer/2022061000/60af63618e0738140559f404/html5/thumbnails/15.jpg)
All-to-One-Randomly assign a value for y and place x as the variable.-For each key(x,y) in keys(x,y), look it up in the dictionary_sort{ }:-Exsiting: loop the cross-classification image and
assign values to the new blank image.-Not: look up for the next one.
![Page 16: CrossTab - Welcome to Zhuoyue's PORTFOLIO! · 2018. 8. 30. · Crosstab toolbox could achieve following objectives: Produce cross-classification image. Create cross-tabulation table](https://reader033.fdocuments.in/reader033/viewer/2022061000/60af63618e0738140559f404/html5/thumbnails/16.jpg)
RUN IT
![Page 17: CrossTab - Welcome to Zhuoyue's PORTFOLIO! · 2018. 8. 30. · Crosstab toolbox could achieve following objectives: Produce cross-classification image. Create cross-tabulation table](https://reader033.fdocuments.in/reader033/viewer/2022061000/60af63618e0738140559f404/html5/thumbnails/17.jpg)
Output Table Comparison
Our Output Table
Output Table from Terrrset
![Page 18: CrossTab - Welcome to Zhuoyue's PORTFOLIO! · 2018. 8. 30. · Crosstab toolbox could achieve following objectives: Produce cross-classification image. Create cross-tabulation table](https://reader033.fdocuments.in/reader033/viewer/2022061000/60af63618e0738140559f404/html5/thumbnails/18.jpg)
Summary:
Crosstab toolbox could achieve following objectives:
Produce cross-classification image.
Create cross-tabulation table that shows the number of transition between categories.
Generate a bar chart that shows the number of pixels in each category.
Create Boolean map to exhibit the transition between user-defined categories.
![Page 19: CrossTab - Welcome to Zhuoyue's PORTFOLIO! · 2018. 8. 30. · Crosstab toolbox could achieve following objectives: Produce cross-classification image. Create cross-tabulation table](https://reader033.fdocuments.in/reader033/viewer/2022061000/60af63618e0738140559f404/html5/thumbnails/19.jpg)
Limitations And Further Research:Limitation:
Could only perform hard classification but not soft classification.
There might be redundancy in the script.
Further Research:
Generate a thematic map for land cover change.
Create gains and losses bar chart for land cover categories.
![Page 20: CrossTab - Welcome to Zhuoyue's PORTFOLIO! · 2018. 8. 30. · Crosstab toolbox could achieve following objectives: Produce cross-classification image. Create cross-tabulation table](https://reader033.fdocuments.in/reader033/viewer/2022061000/60af63618e0738140559f404/html5/thumbnails/20.jpg)
Question?