|
|
| GeoCommunity Mailing List |
| |
| Mailing List Archives |
| Subject: | Re: GISList: converting a grid into square polygon |
| Date: |
07/31/2002 03:19:22 PM |
| From: |
Quantitative Decisions |
|
|
At 09:13 PM 7/23/02 +0800, Shih-Liang Chan wrote: >I'm looking for a tool to convert every single cell of a grid theme into >square polygons in shapefile format. I'll be highl appreciated if someone >can provide me with any suggestion. Thanks,
The terminology used in this question indicates you are using Spatial Analyst.
Populate a grid with random integers and then convert that to a shapefile. The Map Calculator expression is
(grid.MakeRandom * 1000000).int
Provided no two neighboring cells have the same value, the result will be perfect. It is highly unlikely that two neighboring cells will have the same value, so if you get fewer shapes than you expect, simply try again.
(In any grid of dimensions M by N, there will be 2*M*N - M - N pairs of neighboring cells, and therefore the chance of all pairs having distinct random values is approximately 0.999999^(2*M*N-M-N), which is about 0.999998 raised to the number of grid cells. This chance is close to 100% until the number of grid cells gets into the hundreds of thousands. One could increase the chance of success even further by using random integers with a range greater than 1,000,000, but limitations in Spatial Analyst preclude that.)
This method will not transfer the grid theme attributes to the shapefile polygons. One way to get the attributes is to add the centers of the shapefile squares as a theme in the view (compute the x, y coordinates of the polygon centers, then add the table as a point event theme). Convert the original grid to a shapefile in the usual way. Perform a spatial join of that shapefile to the polygon centers. The rest is easy.
--Bill Huber www.quantdec.com
cc: GISList (because the return address could not be reached)
To unsubscribe, write to gislist-unsubscribe@geocomm.com ________________________________________________________________________ Setup a GeoCommunity Account and have access to FAST DataDownloads and Premium Career Posting at a discounted rate! https://www.geocomm.com/cgi-bin/accounts/login
On-line Archives available at http://spatialnews.geocomm.com/community/lists/
|
|

Sponsored by:

For information regarding advertising rates Click Here!
|