I've got what I'm hoping will be an interesting question. I'm working on an assignment for an intro to GIS course that uses some Gulf oil spill data to introduce common vector-based spatial analysis methods (buffers, overlays, etc.) I've got a polygon feature class that holds the bounds of the Deepwater Horizon oil spill on a given day, and I'm simulating its expansion with buffers.

It does the job to illustrate the concept, but certainly doesn't provide realistic results. It got me thinking about how this could be done in a way that provided less uniform results, mimicking/faking the effect of currents directing the oil in various directions as it expands.

In a general sense, I'm looking for a workflow that would accomplish the following given an input polygon feature:

  • Create a new polygon feature that is bigger than the original by a specified area (like 10 sq. km.) or maybe a specified factor (like 5%)
  • The new polygon feature would have an arbitrary shape, with the caveat that...
  • The new polygon feature would contain the original polygon feature (this point isn't a deal breaker, but would be nice to have)

Any real-world solution would have to involve modeling ocean currents, fluid dynamics, and the like, which goes well outside the scope of what I'm trying to do (though solutions incorporating this are certainly welcome and would be interesting to see), but the idea has piqued my curiosity about the underlying spatial problem and I'm curious what solutions are out there. I've got one solution in mind, but I'd like to hear what solutions others may have.

I'm working in the ESRI world, but solutions that involve other packages/platforms are certainly welcome (though I may not be able to test them). General algorithms, pseudocode, and code are fine as well.

  • 2
    There are interesting and innovative solutions, but I am concerned about the implicit premise that such an exercise would have anything at all to do with oil spills. The amount of scientific information involved is not more than available to a philosopher gazing at his navel. Sure, it's fun to spread polygons around--I remember hearing an ESRI rep describing doing this for fire simulations with ArcView 2 back in '96--but how do you justify saying this process is anything but arbitrary and possibly misleading?
    – whuber
    Commented Oct 14, 2010 at 18:04
  • 1
    @whuber - I'm not claiming the results would be anything but arbitrary. Having an arbitrary result is something I'm actively seeking in the question. You're right that the results would bear no resemblance to the real world. That's part of the reason why I titled the question as I did (as opposed to "Simulating the expansion of an oil spill"). I'm interested in the computational geometry/GIS methodology aspect, not its application in any specific domain. The oil spill part was simply the impetus for thinking about an interesting spatial problem. I'll try and clarify this in the question.
    – James M
    Commented Oct 14, 2010 at 19:16
  • Forgot to mention: there's a question in the assignment asking the students to think about why using the buffer tool this way is a bad choice if you're trying to reflect reality. So if anyone's worried that I'm trying to pass this off as realistic, don't be :)
    – James M
    Commented Oct 14, 2010 at 19:54
  • Thanks. I was concerned that impressionable students, upon seeing a cool graphical demonstration of expanding polygons along with some mention of "oil spill," might uncritically accept the former as a realistic representation of the latter.
    – whuber
    Commented Oct 14, 2010 at 21:46

5 Answers 5



Here I think is a little fun way of doing it in PostGIS. This I think could be extended so the expansion follows some linestring representing the current. But now it just expands in one direction.

It iterates 50 times and for each iteration takes the polygon from last iteration, moves it, bufferes it (simplifies it to make things run smother) and uniones it with convexhull. I thought convexhull gave a nicer result than unioning it.

So the result is 50 polygons getting bigger and bigger. Every bigger polygons totally overlaps all smaller polygons.

To see the result you can try it at http://postgisonline.org/map.php

Just copy the sql-code below and click "map1"

WITH RECURSIVE t(the_geom, n) AS ( SELECT 'POLYGON((10 10,8 13, 10 15, 12 14, 15 15, 16 12, 15 10, 10 10))'::geometry AS the_geom, 1 as n UNION ALL SELECT ST_Convexhull(ST_Collect(ST_Simplify(ST_Buffer(ST_Transscale(the_geom, 1.3, 2.7,1,1), 1), 0.1), the_geom)) , n+1 as n FROM t WHERE n < 50 ) SELECT the_geom FROM t;

If you want to just see the polygon from the 30:th iteration you can add
limit 1 offset 30
between the t and the semicolon in the end

generating those 50 polygons uses about 50 ms so it should be possible to expand the model without too much waiting.

Regards Nicklas

This one was even nicer I think:

WITH RECURSIVE t(the_geom, n) AS ( SELECT 'POLYGON((10 10,8 13, 10 15, 12 14, 15 15, 16 12, 15 10, 10 10))'::geometry AS the_geom, 1 as n UNION ALL SELECT st_convexhull(ST_collect(ST_Simplify(ST_Buffer(ST_Transscale(the_geom, 1.1*n, 15,1,1), 0.2*n), 0.1), the_geom)) , n+1 as n FROM t WHERE n < 50 ) SELECT the_geom FROM t

simulating the expansion turning right

  • That's a neat solution, and yet another reminder that I need to find time to start learning about GIS in a spatial database context. It's a good example of why a site like this works. Not only do I find a solution that's completely different than what I had in mind, but I find a new resource as a bonus.
    – James M
    Commented Oct 18, 2010 at 13:03
  • Yes, there is a lot of posibilites with spatial sql. The above query is a little bit more hard to read than usual because of the recursive part. There is a lot of great recources out there to help getting started. Commented Oct 20, 2010 at 15:19

whuber's caveats are important, and as long as you're doing this for illustrative purposes only and don't want to pull into play fluid dynamics, which is possible but complicates the problem.

That said, I think its an interesting question, and could be fun for the students. Another way to look at the problem is to think of it as a raster-based phenomena, with the density of oil measured within each cell. From there, you could use a model which takes into account ansiotropy such as r.spread (documentation) to model the growth rate, perhaps including faux-currents to 'direct' the spread. You could similarly do something with different kinds of focal operations within ArcGIS, using irregular shapes to get around the problems of linear buffering.


I think I'd be tempted to get vector features which represent the currents, and use these as control vectors in a warping operation. The key would be scaling the vectors correctly so as to mimic a single day's spread.

I agree with Andy W that dropping the boundary into points might be a pre-requisite. You might also need to densify the number of points to get an accurate result.

Not sure how you warp in the ESRI world I'm afraid. I know the Data Interop extension would do it, but I presume there must also be either a built-in method or an extension specifically for this sort of thing.


I wouldn't be surprised if somebody has actually done similar simulations, but here is how I think I would approach the project (not having any prior knowledge about Oceanic processes that would diffuse the oil spill).

If you want to strictly work with polygons, I would slice up your boundary into a predetermined number of points. Using those points, I would introduce your simulations, with stochastic elements in regards to the direction of expansion and distance of expansion (within pre-determined reasonable bounds), repeat those steps as many times as necessary. Then re-make the convex hull of all the points based on the new locations (if you want this to always include the previous polygon you will have to limit the expansion outwards). For an intro GIS course I would probably just visualize several different possible iterations given those stochastic elements.

Also alittle different approach, I think visualizing the oil as agents in a simulation could be pretty cool. For example for every crude barrel of oil spilt make a new agent, then add the same stochastic elements as I said before. You could either visualize the expansion of agents throughout the Gulf in time, or visualize the density of oil in time.

It sounds like a really cool project, and post pictures when your finished.


Just to illustrate the variety of results a question like this can generate, I'll tack on the solution I was brainstorming when I posted the question. I'm hoping to get a chance to implement it in the next couple days, and will post it when I do.

  1. Rasterize the polygon into a binary raster.
  2. Create a raster larger than the results of 1 with randomly placed 0 and 1 values. The distribution of 0 and 1 values would match the amount that the polygon needs to expand. So if the polygon needs to expand 5 sq. km. to reach its target, there would be 5 sq. km. worth of 1 cells.
  3. Union results of (1) and (2).
  4. Remove all cells from the result of (3) that aren't adjacent to the original rasterized polygon.
  5. Feed the results of (4) into (2) in place of the original rasterized polygon, and repeat until the number of (1) cells matches the target area.

It's probably not the most efficient way to do it, but it should work. The idea is based on an urban growth modelling exercise that an upper-year class does. Their random raster is created based on suitability for growth, and they don't have area limitations, but the random growth part is essentially the same.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.