RTS terrain grid

Hi guys. I’m trying to create a simple rts game on UE 4 and had stuck on implementation of building logic. I have terrain generated from heightmap and textured with four textures (grass, stone, sand, snow). It should be only possible to build objects on terrain textured with stone texture. As far as I understand, I need to have a grid which covers this generated terrain in order to mark areas I can place buildings (and to store which texture is in each grid tile). Something similar to this:
Grid example

(this image is not from my project)
I can’t find the way to generate such grid for terrain. Maybe you can give me some ideas/clues about it?

Thanks in advance

What you are seeing is just a material. You need to spawn an actual grid on top of your terrain (or made up of chunks of your terrain in blocks or something). You could just use a flat plane mesh that you make invisible with a material. That way you can detect collision, mouse clicks that sort of thing and get a reference to the actor. Click on a tile and you can call a function within that tile to spawn a building of some type on it. Or maybe the tile returns false or something if you can’t interact with it.