# Converting point data into a weighted raster

I am completely re-writing my question as i think it was quite confusing before:

I have a number of different points, each point has a -z value. I need to create some sort of raster or a series of polygons which buffers these points.. but i have a few complicated rules!

1. If the adjacent points are of the same z value then the buffer must merge into one polygon.
2. if the adjacent point is a different z value - then the buffers must be weighted in accordance to the depth of the z values, i.e. if one z-value is -10, and the other is -5, then the buffer of the -10 point will take up 75% of the distance between the 2 points. But because there are many points, and they are all related, this buffering will be different on different sides of the point, see diagram!
3. The idea of the weighted voronoi diagram has been suggested to me and that would be perfect if it weren't for all of the points being related to all of the points around its!
4. I know how i would do it on paper - i would divide the space between all points by 10, and then based on the difference between the two points choose where the buffer would start (if there is no difference between the points then the buffer starts in the middle).
5. Although i cannot work out the formula for determining where the buffer starts.. i know it must be derived from the DIFFERENCE between the two points - but i do not have the mathmatical capacity to work out how i would use this to work out the distance!

I am using Arcmap 9.3.1 and am open to python scripting! If you need me to try and explain anything further i will try! i am very confused myself!

-
What is the relationship between the lines and the points in this drawing? What do the colors mean? How would this be represented as a raster? Exactly how is the raster to be "based" on the point values? What exactly are the "some rules" you have in mind? It would help to understand what the original data mean and what you intend the resulting raster to convey about them: are you interpolating, finding a density, spreading, clustering, or doing something else? – whuber May 2 '11 at 14:22
Thanks for the edit: it clarifies the nature of the problem. But it will be next to impossible to propose a solution until you can describe the buffering rules precisely. – whuber May 4 '11 at 21:27
The problem, as you stated it on the ESRI forums, looks fairly simple (although its solution might not be!) But exactly how do you determine that the buffer weight for z=-24 compared to z=-20 must be 75% but for z=-24 compared to z=-23 it is only 60%? What is the formula? And when you say "take up 60% of the space" are you referring to the areas of the buffers or the distances between the boundaries and the points or to something else? – whuber May 8 '11 at 14:28
I mean the distance between the 2 points.. so if they are 10m away from each other and one is -20 and the other is -25 then the -25 buffer will start 2.5m from the -20 point! – Alice May 9 '11 at 6:36
The question is, how do you determine the value of 75% from the numbers -20 and -25? What is the formula? If you can't provide that then nobody can help you. – whuber May 9 '11 at 14:58

I'm unclear on the drawing portion of your question, so I hope I'm not totally off base here, but it seems to me that you could apply a buffer based on the z-value field around each of your points. Take the resulting polygon and use the polygon to raster tool to create your final raster (if you have ArcInfo). If you don't have ArcInfo I believe gdal_rasterize should do the trick.

Note: If your buffer distance around each point isn't directly correlated to your z-value, just add an extra buffer distance field.

-
@Paul Could you elaborate a little on what you mean by "apply a buffer based on the z-value"? In particular, have you noticed that these values are negative? – whuber May 8 '11 at 14:29
When this question was originally asked it seemed that the area around each point was directly related to the z-value. Now that some clarification has been added, we've found out that the area each point influences is relative to adjacent points and that this area of influence is a percentage of the white space and not a simple linear unit. My answer clearly won't work given the additional information. – Paul May 8 '11 at 14:39
If it turns out that the buffering rules give a unique linear unit for each z-value, then my approach should work. – Paul May 8 '11 at 14:51
@Paul I'm still trying to understand your approach. It is evident that the boundaries of these buffers will usually have variable distances to the original points. What tool in ArcInfo does that and how does it control the buffer distance? – whuber May 8 '11 at 14:58
@whuber : I don't know of any tool that gives a variable distance based on adjacent point and a percentage of the white space between those points. However if these buffering rules (that we don't have) show that each unique z-val has a linear unit associated with it, then a "linear_unit" field could easily be added to the data source and the buffer distance could be based on this new field. I agree with your earlier comment that until we actually know the buffering rules, we won't be able to answer this question. – Paul May 8 '11 at 15:07

If I understand your question, an algorithm that may work (i.e. it does in my head, but I've not tried it), and would require some scripting goes something like this:

1. Generate the Voronoi/Theissen polygons of your points.
2. Take the inverse of those polygons, that is there will now be edges connected to your original points.
3. For each edge e connected to point p, calculate the relative distance along e such that it is a proportion of the end points' weights. I.e. w / (w' + w), where w is the weight of p and w' is the weight of p', the other end of e. (If you need the inverse, that is -10 is "heavier" than -2, just subtract this value from 1).
4. Scale e in proportion to the value obtained in 3), and its new end point will mark the weighted boundary between the two points. Associate this boundary point with p. Do this for every edge, remembering to duplicate the new boundary point for p' so you won't need to calculate it a second time.
5. You will now have a ring of points associated with each of your original points. Join these up into polygons which have a weight attribute that is the same as the point that they enclose.
6. Merge all adjacent polygons with the same weight attribute.

You may need to check that each point p has more than two edges radiating from it to avoid degenerate polygons which may happen with corner cases, but I think that should work.

-
this does sound like a good method! ..Do you know which bits i would need to script? I've only ever done some very, very basic python scripting before! – Alice Jul 22 '11 at 6:13
Unfortunately I'm not much of an arcmap expert, but I expect steps 1, 2, and 6 could be done in the GUI, but the rest would probably need to be scripted. Any ESRI experts out there willing to flesh out the bones? – MerseyViking Jul 22 '11 at 9:14
The inverse of a voronoi diagram is a delaunay triangulation. – Alex Leith Aug 9 '11 at 6:37

I attempted to solve a similar problem recently - I needed to divide clusters of weighted points into regions. Here is the method that ended up working for me:

1. Compute a kernel density raster to distribute the effect of the various points over space. You'll need to play with the bandwidth to make sure that larger points flow into smaller points in way that suits you.

2. Using the raster calculator, find the inverse of the kernel density raster.

3. Using the method mentioned here by @whuber calculate watersheds.

4. Convert the watersheds raster to polygons, join to your original points, and dissolve polygons with the same z-value.

If your bandwidth is appropriate you should end up with polygons that follow the distribution of the point weights. They won't be as mathematically determined as you mention, but they should be close.

Alternate #2: Why not use weighted voronoi and then dissolve regions with the same z-value? Would that not solve the interaction problem between adjacent points?

Alternate #3: If you truly need mathematical precision, you may need a kernel density calculation with a variable bandwidth related to the z-value. You'd have to write this out yourself, but it would simply be a matter of calculating a kernel around each point, adding it to a temporary raster, moving to the next point, adding the next point's kernel and so on. It would be difficult, but it would give you precisely the shape you need.

-
this sounds pretty good! I will test it out tomorrow and let you know! thank you!!! – Alice Aug 11 '11 at 7:20
Alice, did that work for you? – Patrick Aug 16 '11 at 19:15
Ive passed this information along but we haven't had time to test it yet! But when we do i can try this and accept an answer! – Alice Aug 24 '11 at 8:25