Converting position to map grid