oobrien / oomap

OpenOrienteeringMap. Includes the website, tiling scripts, and mapnik stylesheets for OOMap and other raster tile layers.
GNU General Public License v2.0
45 stars 8 forks source link

Autogenerate a course #55

Open oobrien opened 4 years ago

MrYeti1 commented 4 years ago

Hello, big fan of oomap. Thank you for the whole project.

I did some work on this recently, so thought I'd show you my approach. I've uploaded a gist of a script (written in R) that I use to generate random street-lamp score courses of the straight-line distance I want. Then I paste the output into the browser dev-tools on oomap to outputs a map like: oom5e8db0d73a38a.pdf (output steps at the bottom of the gist)

pickControlsForLength is the relevant function. Randomly sample some items from the controlList, calculate straight line distance between all controls, travelling salesperson to get the optimum length. Repeat until a set of controls has the right distance.

https://gist.github.com/MrYeti1/735929c38f976b7849615cf006848a7f

The control sampling is pretty naive - lots of wasted samples that don't make courses of the desired length. It often comes up with overlapping (very near) controls. As I say, it's very naive, but If I run it enough times it outputs a decent course for me to run.

oobrien commented 4 years ago

@MrYeti1 Thanks, that's really interesting and I may borrow/steal some of your logic when I get around to this!

jcundill commented 4 years ago

Hi - big fan here too.

I've also been playing around with trying to autogenerate Urban O courses on and off for a while now. What I've done is open sourced, see https://github.com/jcundill/osmosys for details. README gives a pretty good overview

This project is currently focussed entirely on line, rather than score or scatter, courses and tries to use goal based searching to generate reasonably interesting/challenging legs around the course - good route choice, leg complexity, avoiding dog-legs, etc.

Works pretty well as long as there is sufficient complexity on the map in the selected area.

Please feel free to borrow/steal anything from this one as well.