GEOIPSUM

Have you ever needed to generate some fake polygons to test a geo application?  No... oh.  I have, so I created GEOIPSUM!!!  Mr Maps will never again look longingly at Mrs Text as she flaunts her lorems and ipsums!.  

What does GEOIPSUM actually do?  You make a request to the GEOIPSUM API specifying a few parameters and it returns some randomly generated polygons inside your bounding box as geojson.  Simple.

Example:

http://geoipsum.org/polygons.json?perimeter=300&bearing_range=70&polygon_number=30&bb=46.86,-32.45,56.61,28.45

The parameters here are -

perimeter:  the perimeter of each polygon

bearing_range: this is the amount of deviation from the mean bearing, the larger (max 360), the more jaggy the polygon.  I wouldn't recommend this being too high at the moment as it is likely to cause self intersecting polygons [something I am working on...]

polygon_number:  the number of polygons

bb: the bounding box within which the polygons will randomly sit.

Screen_shot_2011-01-19_at_10

I have also created geoipsum.org so you don't even have to do any typing.  I used polymaps for the map, rails for the app, don't go near the dateline, it's a bit crap.

If you want to take a look at the code to generate the polygons, it is all open and sitting on github.  The long and short is the polygons are generated using a very simple constrained random walk method where both the step length and bearing are constrained with the aim of getting the walk back to the first point in the polygon.  The walk can go off course a little which is why you might see some 'noses' on the polygons.

 

Stuff to keep in mind.

I don't test for self intersections at the moment, I wanted to keep the code as light as possible but will look into making sure all polygons are valid.

It's only geojson at the moment.  I am going to add WKT, maybe shapefiles, maybe not.

If you want a map of American Samoa, you will have to wait, there's a bug near the dateline!

If you want to help contribute any code, feel free.  Just let me know.

Filed under  //   geo   geoipsum   polymaps  

About

Web bloke. Project runner. Terrible poet. Always think I have more time than I do. Need to write shorter posts. Then they might get written. Know a little about protected areas and the sea. Only a little though.