If you really have to spawn it in, this works fine with infinite resources but not much else as it only spawns 350 to a resource area. Changing the density only ads more resource nodes.
/c local surface=game.player.surface
local ore=nil
local size=1
local density=1
for y=-size, size do
for x=-size, size do
a=(size+1-math.abs(x))10
b=(size+1-math.abs(y))10
if a<b then
ore=math.random(adensity-a(density-8), adensity+a(density-8))
end
if b<a then
ore=math.random(bdensity-b(density-8), bdensity+b(density-8))
end
if surface.get_tile(game.player.position.x+x, game.player.position.y+y).collides_with("ground-tile") then
surface.create_entity({name="imersite", amount=ore, position={game.player.position.x+x, game.player.position.y+y}})
end
end
end