RGeo uses external libraries for specific tasks like this. There's a couple of them, but they are, as far a I know, written in C or C++. And they're sometimes broken in other ways as well. So the one we chose, Geos, is the least broken for our needs, but written in C++, and it's a programming language in which you need to type in obscure codes to make things work and I'm not up to this.